# How to instantly stop the rotation of an object in BGE?

I can't stop the rotation of the camera(around the z global axis), in BGE. The camera is set to dynamic. Here is part of the script, the only one that affects rotation.

def rotation():
if (mX < 0.10) and (mY < 0.90):
cam.setAngularVelocity([0, 0, 0.1], 0)
elif (mX > 0.90) and (mY < 0.90):
cam.setAngularVelocity([0, 0, -0.1], 0)
else:
cam.setAngularVelocity([0, 0, -cam.getAngularVelocity().z], 0)
#print (cam.position)
print ("Angular Velocity :",cam.getAngularVelocity())


Setting the angular velocity to 0 does not work.So what I did was to subtract the current value(cam.getAngularVelocity().z). This kills the rotation but it is still slow and it creates a flickering effect.

Here is the blend file

• could you convert it to a static object? – Scalia Apr 28 '15 at 20:50
• I do not want to, since I would not be able to use velocity no more.What's on your mind though? – Lev Apr 28 '15 at 20:58

This appears to be a reported bug

Workaround: use a very small value like 0.00000012

def rotation():
if (mX < 0.10) and (mY < 0.90):
cam.setAngularVelocity([0, 0, 0.1], 0)
elif (mX > 0.90) and (mY < 0.90):
cam.setAngularVelocity([0, 0, -0.1], 0)
else:
cam.setAngularVelocity([0, 0, 0.00000012], 0)

• Many thanks! That was it. I think this bug is for linear velocity also, but I fixed it with what you suggested. – Lev May 5 '15 at 13:07