TwoD
28-04-2007 17:49:20
Hi All.
I've been using Ogre for some time so I'm pretty familiar with it.
Recently I learned Python to quickly develop a small game prototype which will use some simple physics.
For this I'm using python-Ogre, OIS, and the python wrapper of OgreODE (latest versions I found). However, I'm having trouble getting something as simple as gravity to work.
I start by creating a World instance, giving it the (by that time empty) SceneManager.
I set the gravity to (0,-10,0).
I load a .scene and a .mesh (created in Maya 8.5). It's just a simple cube and a light so I can see it.
I find the Entity in the SceneManager, create a Body (sending the World) and attach it to the Entity parent SceneNode.
I set a SphereMass of mass 1, and radius 1 on the Body.
Each frame I do world.quickStep(0.01) and expect the cube to fall out of view, but nothing happens.
I also try to apply a force (10,0,0) to the Body when pressing a button, but it doesn't move the SceneNode either.
I can see that the force is registered since body.getForce() returns (10,0,0)
What am I missing?
As I've understood it, the applied forces (including gravity) should move the Body, which in turn repositions its parent SceneNode, moving the cube along with it each simulation step. But the SceneNode always has the same derived position.
EDIT: I have of course been looking at the examples mentioned all over the forum, as well as the official ODE site to try to debug this. But after two days of no progress I'm thinking I must have missed something really obvious.
EDIT Again: I finally got something working. I still don't see why it didn't work before but now I'm using the stepper classes which comes with ogreOde to update the world instead.
I'd still like to se more examples of working python-Ogre code tho.
I've been using Ogre for some time so I'm pretty familiar with it.
Recently I learned Python to quickly develop a small game prototype which will use some simple physics.
For this I'm using python-Ogre, OIS, and the python wrapper of OgreODE (latest versions I found). However, I'm having trouble getting something as simple as gravity to work.
I start by creating a World instance, giving it the (by that time empty) SceneManager.
I set the gravity to (0,-10,0).
I load a .scene and a .mesh (created in Maya 8.5). It's just a simple cube and a light so I can see it.
I find the Entity in the SceneManager, create a Body (sending the World) and attach it to the Entity parent SceneNode.
I set a SphereMass of mass 1, and radius 1 on the Body.
Each frame I do world.quickStep(0.01) and expect the cube to fall out of view, but nothing happens.
I also try to apply a force (10,0,0) to the Body when pressing a button, but it doesn't move the SceneNode either.
I can see that the force is registered since body.getForce() returns (10,0,0)
What am I missing?
As I've understood it, the applied forces (including gravity) should move the Body, which in turn repositions its parent SceneNode, moving the cube along with it each simulation step. But the SceneNode always has the same derived position.
EDIT: I have of course been looking at the examples mentioned all over the forum, as well as the official ODE site to try to debug this. But after two days of no progress I'm thinking I must have missed something really obvious.
EDIT Again: I finally got something working. I still don't see why it didn't work before but now I'm using the stepper classes which comes with ogreOde to update the world instead.
I'd still like to se more examples of working python-Ogre code tho.