# [PyODE] Rotation of the box always corresponds motion direct

Hello. Im using PyODE to do 2D physics in my game. I’m just learning to use ODE at the moment, so I’ve got one problem I can’t solve. How to make the rotation of the box body to be always corresponding to the direction of it? For example take a look at this picture:
jasonuniverse.appspot.com/file/a … GlrGImkAQw
When blaster shot reach the lightsaber, it’s obvious that it’s rotation around it’s axis will be corresponding to the direction (after reflection/bounce). Where should I make changes? Apply any methods to ode.Body or ode.GeomBox? Or some changes in collision handling?

``````		contacts = ode.collide(self.odeGeom1, self.odeGeom2)
for contact in contacts:
contact.setBounce(4.0)
contact.setMu(0)
contact.setMu2(0)
j = ode.ContactJoint(self.odeWorld, self.odeContactGroup,contact=contact)
j.attach(self.odeGeom1.getBody(), self.odeGeom2.getBody())``````

Is there a simple way to do that with ode?
That’s how the game looks for now:
jasonuniversetest.appspot.com/fi … xpaxjBtQMM
You can move lightsaber and rotate it to reflect troopers blasters and it’s working without ode, but the physics are very poor, so I wanted to use ODE to allow players to reflect blasters as they like I know it’s not using panda (it uses PyGame+OpenGL+ODE), but ODE is related to Panda and there are ODE users on this forum. Thanks for help in advance

Since sci-fi laserbeams don’t have a mass or friction and fly at constant speeds, I not sure what you actually need physics for.

I’d calculate everything in Python. It sounds as simple as
-get the vectors of lasershot and of the saber
-get the tangent vector on collision (easily done with panda’s collision detection)
-calculate the reflected vector (there are special methods on vectors, matrices and planes for that).