how can i put gravity to objects?
how can i put gravity to objects?
i want to add some mensters in my map, but how can i put the gravity so he can walk in the terrain correctly
opensource = freedom
<br>
how can you face the problem if the problem is your face?
<br>
how can you face the problem if the problem is your face?
First you create one of the triangle selectors for your terrain.
Then you can add an ISceneNodeAnimatorCollisionResponse to the scenenodes of your mensters(?) and pass that triangle selector to it.
Check the ISceneManager documenation for the functions needed for that: http://irrlicht.sourceforge.net/docu/cl ... nager.html
Please also check the tutorials - there are several tutorials using collision against the floor, for example the terrain tutorial.
Then you can add an ISceneNodeAnimatorCollisionResponse to the scenenodes of your mensters(?) and pass that triangle selector to it.
Check the ISceneManager documenation for the functions needed for that: http://irrlicht.sourceforge.net/docu/cl ... nager.html
Please also check the tutorials - there are several tutorials using collision against the floor, for example the terrain tutorial.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
i think ive already done that but the meshObject is still floating...
scene::IAnimatedMesh *mesh map mesh
scene::IAnimatedMeshSceneNode *node map node
scene::IAnimatedMeshSceneNode *meshObject the monster where iw ant to put gravity...
[/code]
scene::IAnimatedMesh *mesh map mesh
scene::IAnimatedMeshSceneNode *node map node
scene::IAnimatedMeshSceneNode *meshObject the monster where iw ant to put gravity...
Code: Select all
void udPutGravityToObjects(scene::IAnimatedMesh *mesh, scene::IAnimatedMeshSceneNode *node, scene::IAnimatedMeshSceneNode *meshObject, SKeyMap keymap[], scene::ISceneManager *smgr)
{
scene::ITriangleSelector *selector = 0;
if(node)
{
selector = smgr->createOctTreeTriangleSelector(mesh, node, 1024);
node->setTriangleSelector(selector);
}
if(selector)
{
scene::ISceneNodeAnimator *anim = smgr->createCollisionResponseAnimator(selector, meshObject, core::vector3df(50, 100, 50),core::vector3df(0,-10,0),core::vector3df(50,100,50), 0.005);
meshObject->addAnimator(anim);
anim->drop();
}
}
opensource = freedom
<br>
how can you face the problem if the problem is your face?
<br>
how can you face the problem if the problem is your face?
Hm, looks correct to me on first view. You have set some ellipsoidTranslation - maybe it is on the floor already, but just translated up so much that it seems to float? Did you try using other values for that?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
yeah, its already working, just set the value to default...
one more thing...
why is it that when i add a flystraightanimator the monster cant have its gravity...
are they overwriting each other>?
how can i put multiple animators for a scenenode?
thnx
one more thing...
why is it that when i add a flystraightanimator the monster cant have its gravity...
are they overwriting each other>?
how can i put multiple animators for a scenenode?
thnx
opensource = freedom
<br>
how can you face the problem if the problem is your face?
<br>
how can you face the problem if the problem is your face?
Multiple animators often conflict simply because they try to set the same values. If one animators says "go down" and another says "follow that line" then there is an obvious conflict.
I guess you want to have some monsters walking on the floor along some line. I think you will have to write your own animator for that.
I guess you want to have some monsters walking on the floor along some line. I think you will have to write your own animator for that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 277
- Joined: Thu Dec 15, 2005 6:11 pm