How can I render a capsule shape without the mesh in NxOgre?

lxcid

03-12-2007 08:57:34

How can I render a capsule shape without the mesh in NxOgre?

alienskull

03-12-2007 09:47:11

use createActor instread of createBody

mPhysicsScene->createActor( "name", new NxOgre::CapsuleShape( radius , length ), NxOgre::Pose( position, rotation ) );

lxcid

03-12-2007 11:38:45

ops, I'm sorry...

What I mean was is there a way to create a shape and generate the mesh on the fly???

betajaen

03-12-2007 11:51:29

You mean change the capsule(CapsuleShape) on the fly, or the visualisation of the mesh (SceneNode/Entity) on the fly?

alienskull

03-12-2007 12:09:18

I'm not 100% sure what you mean..

but if you mean create an actor(CapsuleShape) and then later (on the fly) attach an entity to it.. just create an actor like above and then create a node, and then every frame sync the position rotation of the node to the actor

NxOgre::Actor* collision = mPhysicsScene->createActor( "name", new NxOgre::CapsuleShape( radius , length ), NxOgre::Pose( position, rotation ) );

SceneNode* node = mSceneMgr->createSceneNode( "name " );


and then in your update function (or frame listener)

node->SetPosition( collision->getGlobalPosition() );
node->setOrientation( collision->getGlobalOrientation() );


and if you want later you can create/destroy entities as long as you attach them to that node

Entity* ent = mSceneMgr->createEntity( "name" );
node->attachObject( ent );




but if you meant to change the capsule(CapsuleShape) on the fly
then you have to create a new shape and destroy the old one.. as far as i know

lxcid

04-12-2007 03:30:21

Arh~ thanks.

I would like to visualise the capsule on the screen. like when i call create actor, it automatically create an mesh and an entity? is it possible?

dbrock

12-12-2007 06:01:06

You may have to use the Visual Debugger to see the capsule on screen. If I understand your question, your thinking that the CapsuleShape is a mesh, but it's just a way to tell PhysX some information on what your collision areas are.

If you want to see this capsule, you'll have to make yourself a mesh by exporting one from a 3d program (like max, using lexiexporter for example).

Then you can use createBody, and specify your mesh file.

This is all assuming I understood your question ;).

Good luck!

toglia

02-06-2008 08:28:14

Hmmm... I have always used the remote debugger for this, the problem is that you don't see the visual mesh in there. Having the possibility of seeing both should be quite helpful when scaling to fit certain object.

I have seen other people rendering PhysX collision shapes. Look at this:
http://youtube.com/watch?v=RR0lIdaMSys&feature=related
(at least they look like they are)

Really don't how he's doing that, would be great to know though...

betajaen

02-06-2008 09:40:06

This?

mWorld->createDebugRenderer(mScene);

Terrain may crash or slow your application to a halt when that's on though.