Hi all,
I have been trying to get a sphere to roll in the direction of the camera, similar to how BB8 from Star Wars or a Sphero ball.
self.character.setHpr(self.character,0,self.z_velocity *-5 *deltaTime * (math.cos(math.radians(self.playerBase.getH()))),(self.z_velocity * deltaTime *5* (-math.sin(math.radians(self.playerBase.getH())))))
One thing to note is that they work perfectly individually, so If roll is set to 0, the ball would rotate perfectly in the pitch axis whereas if pitch is set to 0 in the command above and roll remains unchanged, it would roll perfectly, if I combine the two movements it wouldnât work and the rotation is a bit wonky.
The full code is available here, specifically player.py
(code above is at line 250), and once again, if any parts of the code needs explaining, I am happy to clarify them