I am trying to rotate a SCNNode
with a JoyStick
but when I use the .eulerAngles
property the SCNNode
doesn't seem to be affected by any physics. Thats why I want to use angularVelocity
or angularVelocityFactor
. Except there is another option.
Here I get the x and y values from my 2D JoyStick
(touches moved function):
dx = base.position.x - ball.position.x
dy = base.position.y - ball.position.y
angle = atan2(dx, dy)
In the update function I set the velocity of the SCNNode
(this is working):
playerNode.physicsBody!.velocity.x = Float(dx)/10
playerNode.physicsBody!.velocity.z = Float(dy)/10
What do I have to do to rotate my SCNNode
in the same direction as the JoyStick.