Sign in to follow this  
JasonSpine

[PyODE] Rotation of the box always corresponds motion direction

Recommended Posts

JasonSpine    101
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:
http://jasonuniverse.appspot.com/file/ag1qYXNvbnVuaXZlcnNlcgwLEgRQbGlrGImkAQw
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())

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this