Animating bodies

Prophet

10-09-2008 13:50:11

I was thinking, if I have a body connected to a node (obviously) and that node is animated and animates during play, how will this affect NxOgre and what will come first/last, animation or physics? (If I have the body controlled and rendered by Ogre)

betajaen

10-09-2008 14:07:55

Depends what is animating.

- If a light is blinking, then no need to animate.

- If it's doing the Jitter Bug, then obviously you'll need a solution to move those shapes to represent what it looks like - physically. Roughly; You would need some sort of callback to that animation with a copy of the parts that have moved (with their positions, orientations and sizes), then apply that to the Actor's shapes. If you have your own Body; then theoretically this could all be done in a single class (The Body being an Actor, RenderableSource, AnimationCallback).

However; Using an Actor with a compound of shapes is normally reserved for simple things.

Real physics applications use a compound of Actors with a SkeletonRenderable - which is something I'm working on myself.

Prophet

10-09-2008 14:26:50

Well, I rarely use physics on a light...
I was more thinking, say I have a box which I load and it's attached to a SceneNode. This SceneNode is also a part of a Body. If I each frame iterate through the scenes animations I will force the SceneNode to move (if it's the SceneNode that's animated, that is), while PhysX/NxOgre will try to apply gravity and all kind of forces to it, like random falling whales. What will be the result? Will NxOgre get the hint and not try to move the box, or will it move the box and next time the animation is played (next/same frame), it will teleport the box to where it's supposed to be according to the animation, whilst leaving NxOgre all confused and lost how it got there?

betajaen

10-09-2008 14:34:07

Nope; NxOgre is a heartless bastard and will move the SceneNode regardless if you haven't moved it, or tarted it up with fairy lights and put on a sign saying "Please don't move me".

If your referring to mesh/skeleton animation (I'm thinking of the animated Robot demos in Ogre) then that's an Entity which NxOgre doesn't touch.

Prophet

10-09-2008 14:49:53

No, it's just a thought the kept me awake yesterday/today.
Then, when is it simulated? First thing each new frame? If so, it won't impact much. But if it's the last thing and has an enormous force pushing it down, it might be noticeable displaced.