#Here's the ball control. Beware... #Max speed and forward maxspeed=5 vec_vel = mathutils.Vector((0,0,0)) if keypressed in[up]: vec_vel.x = -maxspeed if keypressed in[down]: vec_vel.x = maxspeed if keypressed in[right]: vec_vel.y = maxspeed if keypressed in[left]: vec_vel.y = -maxspeed vec_vel=vec_vel.xyz; vec_vel.z*=-1 if vec_vel.magnitude: vec_vel=camhelper.worldOrientation * vec_vel vec_vel.z=0 vec_vel.magnitude = maxspeed ball.alignAxisToVect(vec_vel) ball.applyTorque(vec_vel)
This is the code I have assembled. The ball rolls when key pressed, good.
Not so good is when changing direction, because, obviously the ball aligns itself with the rotation given.
The question is, how can I set up a system that updates the ball’s rotation to the rotation of the camera?
Also, using this thing Torque (that I very much like), having maxspeed capped at 5, how can I prevent the ball’s amazing increase in rotation?
All else is going great… .blend refuses to be attached, maybe the size is too “grande”…