Questions tagged [swift]

Swift is a multi-paradigm, compiled programming language.

19 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
316 views

How to determine the angular velocity needed move an object to a given position

I am trying to move two lines joint to a fixed position sprite in a way similar to that of a pendulum. I would like the lines to swing from end to end each time. The image below shows what I want to ...
3
votes
1answer
1k views

How can I avoid a delay with continues touch detection in swift?

I want control a character on my screen with a continuous swipe gesture. As soon as I do a swipe +x or -x my character moves ...
3
votes
2answers
1k views

How to add a bump map in scene kit?

I'm trying to draw an Earth, as I've found the textures in this site: http://planetpixelemporium.com/earth.html I loaded the diffuse, specular and bump maps: ...
2
votes
1answer
310 views

How do I apply touches to images, using Swift?

I need code this game for iOS, using Swift; but I don't know how to apply touches to images, using Swift. My attempts thus far have failed; touch!.view != image. <...
1
vote
1answer
282 views

calculating the trajectory of an object in SpriteKit when an impulse is applied to it

I want to make a trajectory line of little balls of where the object is going to go after an impulse, sort of like what is in Angry Birds. I did some research and it seems that the physics in ...
1
vote
0answers
274 views

One SKSpriteNode with multiple PhysicsBodies?

I am making a game similar to Lunar Lander, when you land with your ship on different objects, etc... The issue I am having is that I have a Player SKSpriteNode (my Ship) with a slightly complex ...
1
vote
0answers
273 views

Swift Spritekit: Create realistic driving sprite

How would I go by creating a realistic driving experience? I'm using iOS Swift 3 with SpriteKit using the functions applyForce to accelerate when I click the gas button and when braking I add ...
1
vote
0answers
447 views

Failed to pass uniform in Metal shader modifier

I'm trying to write a simple shader able to pass the color to be used for drawing in the fragment shader, through a uniform. I load the shader modifier and pass the uniform: ...
1
vote
0answers
199 views

How do I simulate vehicle movement in a non-gravity environment (e.g., space)?

As a series of small experiments, I've began to tinker with game development, specifically using SpriteKit and Swift. I'm looking to simulate a body moving through a non-gravity environment, ...
1
vote
0answers
121 views

swift fast enumeration on MDLAsset not working

I load an MDLAsset from my main bundle and get an compile error when fast iterating the asset object. Type 'MDLAsset' does not conform to protocol 'SequenceType' ...
0
votes
0answers
11 views

making an SKSpriteNode collide with another SKSpriteNode through the use of a projectile image

i am having a lot of troublefiguring out why my projectile will not shoot the image of luke. I have tried many different methods to try and counteract this but none of the strategies have seem to ...
0
votes
0answers
18 views

How to match user drawing with predefined drawing model?

i am trying to develop image recognition iOS app , i will have one reference image , and user has to draw something one screen and when user release finger , then i will convert his drawing into <...
0
votes
0answers
26 views

Move SKEmitterNode along with the trail that it creates

In Swift in SpriteKit, I have a SKEmitterNode that I have set up to make trails following the player. I have the target set to self, the scene so that it will make these trails when moved. I would ...
0
votes
0answers
103 views

Swift Error “unrecognized selector sent to instance 0x7f96875356e0”

This is the function i am trying to spawn obstacles in my game ...
0
votes
0answers
24 views

Managing character movement in 3D in AR

I'm working on an ARKit project where I need to manage the movement of an object (white box) on a plane (blue square). The characteristics of the environment are : The box can move only in 2D along ...
0
votes
0answers
118 views

Testing for connected maze cells

I'm currently in the middle of writing a game where there is a maze. The maze itself is already drawn ok, and once I have the layout I randomly rotate all the pieces. I have a 'start' cell that is a ...
-1
votes
1answer
306 views

SceneKit – White layer covering my tube

I have a simple tube node in my scene that isn't displaying properly. When I rotate it to face the camera, more than half of it is covered by some invisible sheet. When I rotate the tube enough, it ...
-1
votes
1answer
456 views

Fix buttons on screen

I've added buttons and SKCameraNode for my player. I got problem. When player moving left/right/jump all buttons dont follow for him. UPDATE class GameScene: SKScene, SKPhysicsContactDelegate { <...
-2
votes
1answer
354 views

Is it possible to use Box2D or Chipmunk in Swift & Cocos2d?

I am new to iOs programming. I wonder whether it is possible to use Box2D physic engine in Cocos2D with Swift. I am asking because I started to learn Swift. And I create Xcode project from ...