About the SimpleMotor and joints in a platformer...
Posted: Fri May 21, 2010 8:43 am
Hi, all!
I'm leading a 2d-platformer game project, in which I decided to let Chipmunk do the physics. I've been very impressed by its performance indeed! However, I've come up with many questions, since I just cannot figure out everything by playing with the library and reading through the documentation. So, I decided to sign up here.
At the moment I'm impementing the characters and their movement. Since surface velocity isn't working very well, I've been reading through the forum and decided to give the wheel-motor-contraption a try. Now I have a wheel below the joint. This is my configuration:
Main Object (body and shape) <- body has inertia set to infinity so it won't rotate (or "fall over")
The Wheel (body and shape) <- body has its inertia calculated for this circle
PinJoint <- connects the bodies of these two objects above... the wheel's anchor point is at (0,0) <- origo
SimpleMotor <- sets the angular velocity between the bodies of these two objects
My perception by reading the documentation is that PinJoint locks two bodies together at a given point. Contrary to this, when I run the simulation, my Main Object and The Wheel seem very loosely connected and even when the weel bumps into something it begins rotating along a totally arbitrary axis which looks very dizzy. So my question is, how do I lock these two bodies as it's done in real vehicles; so that their anchor points stay at where I've put them?
Thanks in advance,
Slembcke, you've done great job with the lib! I wish I'll master its full use some day.
EKr
I'm leading a 2d-platformer game project, in which I decided to let Chipmunk do the physics. I've been very impressed by its performance indeed! However, I've come up with many questions, since I just cannot figure out everything by playing with the library and reading through the documentation. So, I decided to sign up here.
At the moment I'm impementing the characters and their movement. Since surface velocity isn't working very well, I've been reading through the forum and decided to give the wheel-motor-contraption a try. Now I have a wheel below the joint. This is my configuration:
Main Object (body and shape) <- body has inertia set to infinity so it won't rotate (or "fall over")
The Wheel (body and shape) <- body has its inertia calculated for this circle
PinJoint <- connects the bodies of these two objects above... the wheel's anchor point is at (0,0) <- origo
SimpleMotor <- sets the angular velocity between the bodies of these two objects
My perception by reading the documentation is that PinJoint locks two bodies together at a given point. Contrary to this, when I run the simulation, my Main Object and The Wheel seem very loosely connected and even when the weel bumps into something it begins rotating along a totally arbitrary axis which looks very dizzy. So my question is, how do I lock these two bodies as it's done in real vehicles; so that their anchor points stay at where I've put them?
Thanks in advance,
Slembcke, you've done great job with the lib! I wish I'll master its full use some day.
EKr