Reputation: 41
I have a moving object that spawns object2 thats attached by a sliding joint
When i press the button , the joint is removed and the object2 falls down with gravity
this works, but only falls down on the x axis without retaining its y axis speed.
How can i make Object2 fall down in a more horizontal way like in real life
Upvotes: 1
Views: 521
Reputation:
use after the remove of the joint
object2.physicsBody?.velocity = object1.physicsBody.velocity
object2.physicsBody?.affectedByGravity = true
if you use moveToY take a look at this question
Upvotes: 0
Reputation: 687
You can set velocity directly:
sprite.physicsBody?.velocity = CGVectorMake(10.0,10.0)
Just set the vx the same as the moving object.
Upvotes: 1