2
votes

In my project, I have a node that is moved forward (by applyForce) upon touches began. I would like the object to only move in one direction (z) and never rotate (x). However, when the object hits a body that is at an angle to it, it bounces back at an angle, as would be expected under normal physics.

Ideally, I want it to stop moving on collision and not rotate.

I have already set the physics body's restitution to 0 to prevent a bounce (but it still bounces), and its angular damping to 1.0 to prevent rotation (but it still rotates.) Any other ideas on how I can prevent rotation upon object collision?

cubeNode.physicsBody?.restitution = 0
cubeNode.physicsBody?.angularDamping = 1.0
1
possible duplicate of allowRotation in SceneKit?rickster

1 Answers

3
votes

Found the answer on another thread: set angularVelocityFactor to 0. allowRotation in SceneKit? Apologies for the duplicate question. I searched, but only found the other thread as a link from my own question's page.