Artic_Ice83
07-01-2008 15:15:16
Hi! i'm new to NxOgre and i have read the betajen's short guide and ather few posts in this forum...now i have a question: to create a static body (for example a tree) must i write my own class that inherit from Actor and pass the param static? i tried to pass mass=0 or static:yes as params to a Body, but the application crashes...
betajaen
07-01-2008 15:49:36
It's not crashing because the Actor is static or has no mass. It's crashing because of something else; Have a look at the logs or go through the debugger and trace it.
For the record; The normal way of creating a static Actor (or Body as you want) is:
mScene->createBody("Tree1;tree.mesh", new TriangleMeshShape("tree.mesh"), Vector3(5,2.5,5), "static: yes");
Hi! i'm new to NxOgre and i have read the betajen's short guide and ather few posts in this forum...now i have a question: to create a static body (for example a tree) must i write my own class that inherit from Actor and pass the param static? i tried to pass mass=0 or static:yes as params to a Body, but the application crashes...
Are you talking about the costructor of your Actor's class when you mention "pass param static"? I hope so, because that's the point I think.
However, you can just simply pass the Mass to the contructor (if you haven't already done that), and if the mass is 0, then you create a Static Actor, else you set the Mass to the amount that was passed through the contructor.
The other problem is that you're talking about Bodies and Actors, but they are not the same!
It's not too elagant to create a class named MyActor that inherits from the NxOgre::Actor and to create bodies in it... IMO.
The way you can create static Bodies is this:
mScene->createBody("MeshName.mesh", new CubeShape(1,1,1), Vector3(0,0,0), "static: yes");
You probably don't need to say "mass: 0", if you typed "static: yes".
But the main problem is that you can't say "Mass=0", in the params of the Body, because it works in a different way to define value to the variables.
So if you want to set the mass you have to type "mass: 10".
p.s.: betajaen came before me...
Artic_Ice83
07-01-2008 17:46:41
thanks to all!! now it works well!!
@BonD: the string mass=0 that i wrote in the earlier post was a "write error"...i meant mass: 0... and yes, i meant the params to pass to constructor. i know that bodies and actors are not the same, because bodies have a visualization, while actors (in general) not...
maybe my error was that i created a CubeMesh instead of a triangle mesh shape...