planes and collision

elementarladung

11-05-2007 21:49:10

Hi,
i have two questios to nxOgre and generally Physx.

1) I have two boxes generated with nxOgre
mScene->createBody("cube.mesh", new NxOgre::CubeShape(100,100,100), Vector3(0,30,0), "Mass: 100");
Thyts quit easy. In this sample i will set the collision shape manualle but how do i normally know how big my box or model is ? A better way would be to create a second model wich is a low poly collision model of my rendered model.
mScene->createBody("cube.mesh", new NxOgre::MeshShape("cube_collision.mesh",""), Vector3(0,30,0), "Mass: 100");
In this sample the cube and the collision model are the same file but this sample does'nt work correctly. If i will load more of these bodies they intersect each other. in the first sample not.

What is the correct way to solve these problem ?

2) Is it possible in nxOgre (physx) to create airplanes and how ?

Thx for helping !

betajaen

11-05-2007 22:01:32

1. The size of the collision model, is the size given.

1a. You can't use meshShapes like that, in dynamic bodies and colliding them together. They just don't work like that. You get around with it, using a group of convex and primitive shapes which make a general collision model.

2. Yes, there won't be any air resistance or flight dynamic physics. So in a sense it would "fly" as it would be in a vacuum. You'd have to add the flight dynamic code yourself, which is a whole can of worms there.

elementarladung

12-05-2007 14:28:35

Hmm that means that PhysX is not able to create a helicopter or Airplane ? Do i understand it right ?

Greetings

daedar

12-05-2007 14:44:24

PhysX is just a physic engine, the way you use it depends on what you want to do.
I think what betajaen wants to say is that if you want to have planes or helicopter, you'll have to write your own classes and manage the dynamic of the plane yourself (I've done it with Newton-OgreNewt and it's quite easy).
With your own plane/helicopter classes you can also have your own plane/helicopter settings and so have the exact behaviour you want to have (simulation settings for ex).

elementarladung

12-05-2007 15:15:00

ok thx now it's clear for me :-D

ANdys

13-05-2007 09:38:32

so,the plane/helicopter classes I have to set myself.
Does that means the new simulation class work like CharacterController class to simulate a character?

daedar

13-05-2007 10:30:20

I don't realy know as I'm new to NxOgre but what I did whith OgreNewt for my helicopter class (for my game http://www.ogre3d.org/phpBB2/viewtopic. ... 36b72e4bbc) is something really basic like:

1 - define your shape(s) representing your helicopter (with mass, size,... params)
2 - Add local forces on Y for the rotor every update (callbacks with OgreNewt)
3 - Add torque forces to rotate the helicopter

Once again, this is our setting but you may have to use yours...

betajaen

13-05-2007 12:11:58

I did some work with the leviator class as well, the code is floating around here somewhere, You could combine it with daeders method. But the idea is the same as it is in real-life, apply enough thrust so it overcomes the pull of gravity.