How to set ActorParams to an exist Body?

kidcdf

19-01-2008 14:49:02

we all use it like this:
ActorParams ap;
ap....
ap....
body=scene->createBody("mesh;car.mesh",new TraingleMesh("car.mesh"),ap);

How to set ActorParams to an exist Body? such as:
body->setActorParams(&ap);

kidcdf

20-01-2008 02:49:54

no one knows?

fzh

20-01-2008 07:07:55

you can just use body->set___ for any parameters you want to change.

kidcdf

20-01-2008 07:58:32

you can just use body->set___ for any parameters you want to change.
I want to apply new material to body

fzh

20-01-2008 09:04:17

body->getEntity()->setMaterialName(...)

kidcdf

20-01-2008 10:00:13

body->getEntity()->setMaterialName(...)
I mean NxOgre::Material....

fzh

20-01-2008 10:34:58

o... lol, well a body contains visualisation so it's a bit confusing.

Well you can try this:

NxOgre::material *mMaterial = mScene->getMaterial("name of material u want to change or the index")

mMaterial = your new material, or just change parameters of it using ->set__

betajaen

20-01-2008 11:28:10

You don't apply params to an actor or any NxOgre class after they've been created. It doesn't work that way.


If you want to apply a material to an actor, you don't. You apply it to the shape inside the actor. It's just like PhysX.

Off the top of my head:

mActor->getCollisionModel()->get(0)->setMaterial(identifier);

If the actor has a number of shapes, then you apply the material separately to each one. However it's perfectly normal for shapes inside an actor to have different materials.

kidcdf

20-01-2008 12:16:43

You don't apply params to an actor or any NxOgre class after they've been created. It doesn't work that way.


If you want to apply a material to an actor, you don't. You apply it to the shape inside the actor. It's just like PhysX.

Off the top of my head:

mActor->getCollisionModel()->get(0)->setMaterial(identifier);

If the actor has a number of shapes, then you apply the material separately to each one. However it's perfectly normal for shapes inside an actor to have different materials.


error C2039: “setMaterialâ€

betajaen

20-01-2008 13:18:25

Then get the NxShape from it and set the material index manually.

Come on, hunt around a little.