Help! Game object with both physical and non physical parts

Oceax

14-06-2009 15:03:01

Using [BloodyMess 1.5.4]

Im trying to setup an aircraft object in my game with a more complex structure than usual for me.
When the object is constructed, a blueprint is read and the different parts setup according to it. And it works great if all parts are just physical or just non physical.

The problem is using both nxBodys and simple Ogre sceneNodes in the same game object and also set and make them retain their relative positions to eachother. How can i do that? Or do i have to use actors with joints for everthing in the game object even if its not desired? (nodes for particleSystems, nodes to attache other objects, nodes with entitys without physics)

In the image below, the particleNode is a child node of aircraftBody´s sceneNode (i use nxBody->getSceneNode(); to get aircraftBodys sceneNode). But it dosnt matter where i try to place the particleNode relative to its parent, its allways in the middle of its parent (but it follows when the parent moves). I also tried to have the flaps connected as child nodes without physics but then i couldnt see them at all.



(Link) How it looks in the game (particles should be at the propeller):
http://www.oceax.eu/aircraft2.jpg

betajaen

14-06-2009 16:15:09

Personally; I wouldn't model the flaps or rudder in NxOgre. PhysX can't do flight physics so it would be silly to have them in. You can move them in Ogre just as easily.

I would leave the propeller in, just for collision purposes. But even then I would model it as a disc (and view it as seperate blades), the propeller is moving at such great speeds. Any object is going to be likely caught into the blades so modelling each blade separately will introduce significant error in collisions due to precision of timing and floating points.

My two cents anyway. :)

Oceax

14-06-2009 16:55:01

Personally; I wouldn't model the flaps or rudder in NxOgre. PhysX can't do flight physics so it would be silly to have them in. You can move them in Ogre just as easily.

Ok, but the problem is that for some reason, connecting Ogre sceneNodes in nxBodys with other Ogre sceneNodes doesnt work very well. I tried having the flaps as just Ogre nodes that are child nodes to the aircraftBody node that is in a NxBody. And the result is that the flaps cant be positioned or translated correctly. :?

A reason for using physics on the flaps and rudder is becouse i want the joint to break if they are being shot so that it looks like aircraft is damaged.

betajaen

14-06-2009 17:47:31

Right, joints it is then; the revolute joint will serve very well for the rudder, flaps and even the propeller.

I don't understand why your having problems with relative positions and orientations though, especially with the Ogre SceneNode system - which to be frank is perfect for sub-bodies. Even with not using them; relative positions are pretty straight forward (flapX = planeX + 10).

Oceax

14-06-2009 19:54:08

Problem solved.

Thanks for the suggestions. I might use revolute joint or animation.

betajaen

14-06-2009 20:35:39

Use both.

If the plane is hit (or about to be), quickly add a flap or rudder in for collision. Otherwise leave them out for performance reasons.