update method

jettero heller

10-09-2008 15:45:52

Hi all.

I'm a bit confused about update methods.

In Ogre, the root object calls the frameStarted method on all the framelistener objects registered and I move entity and play animations in this method.
NxOgre has its rendering system and I can make the physics objects (characters, actors...) and graphics objects (entity, mesh, animations) to be the same thing.

Which method I should use to update positions, animation and physics?
Have I to call Character::simulate() in frameStarted() for each frame and update entity's animation in the simulate method??

tnx

jet.

betajaen

10-09-2008 15:53:18

You don't have to. NxOgre has it's own frameListener class to render/simulate for you.

But if you don't want that; then don't use "time-controller: ogre" in the World params, and run:

mWorld->getPhysXDriver()->simulate(deltaTime);
mWorld->getPhysXDriver()->render(deltaTime);


Usually in frameStarted in your framelistener.

jettero heller

10-09-2008 16:23:13

So, have I to put all the code for characters' status update (decrease life, play animation) in the simulate method, right? mmm... Where can I check user inputs?? :?

betajaen

10-09-2008 17:03:26

If "Character" is your own creation then, you should call it's simulate shortly before or after NxOgre's simulate. Since I don't know, I can't tell exactly.

Inputs for Character should be checked when you check the other types of inputs - Escape for quitting for example.

jettero heller

10-09-2008 17:34:17

yes, Character is my own implementation.

If I understood:

1 - in my framelistener I check user input and I set the parameters for my characters
2 - I override simulate and render methods to update characters' status (life, animations, ...) based upon the parameters I set
3 - NxOgre calls simulate and render methods

P.S.
is simulate method to update the physics part (shape...) and render for the graphics part (entity, mesh, animation)?

tnx

betajaen

10-09-2008 17:37:46

Yep to all.