Angular Velocity in the Physics Engine?

I’ve been playing around with the physics engine for the past few hours, and while the force support is not bad at all so far, I’ve run across a problem.

The problem is that, no matter how hard I try, I cannot give my object any sort of angular velocity. I’ve tried setting it directly using PhysicsObject.setRotation, applying and AngularVectorForce to the Physical object, and by using non-centered PhysicsObject.addImpact calls.

Some example code (trimmed down quite a bit):


	# Load car
	car1_actor = ActorNode('actor')
	car1 = render.attachNewNode(car1_actor)
	car1_mesh = loader.loadModel('cars/test.egg') 
	car1_mesh.reparentTo(car1)
	car1.setPos(0,0,30)
	
	# Set up car physics
	base.physicsMgr.attachPhysicalNode(car1_actor)
	
	# Create force nodes
	forcen_car_node = ForceNode('car')
	forcen_car = car1.attachNewNode(forcen_car_node)
	
	forcen_global_node = ForceNode('global')
	forcen_global = render.attachNewNode(forcen_global_node)
	
	spin = AngularVectorForce(0, 0, -2)
	forcen_global_node.addForce(spin)
	
	engine = LinearVectorForce(0, 0, 0)
	friction = LinearFrictionForce(1,1,1) 
	forcen_car_node.addForce(engine)
	forcen_car_node.addForce(friction)
	
	# Add those forces to the car
	car1_physical = car1_actor.getPhysical(0)
	car1_physical.addLinearForce(friction)
	car1_physical.addLinearForce(engine)
	car1_physical.addAngularForce(spin)

So, is there some obvious problem I’m missing, like an optimisation I have to deal with?

OK, solved that one myself. Turns out you need to attach an AngularIntegrator explicitly using PhysicsManager.attachAngularIntegrator.

And the wiki page made it look so easy…