Problem on getBoundingBox() (Newton´s integration)
Problem on getBoundingBox() (Newton´s integration)
Hello, I don´t knwo if this is the right forum to ask it, but anyway
I´m trying to integrate irrlicht with newton, and then I did this:
IrrToNewton = 1/32
//creating the Box
core::aabbox3d<f32> box;
vector3df size;
box = this->meshscenenode->getBoundingBox();
size = box.getExtent() * IrrToNewton;
ncollision = NewtonCreateBox(my_nworld, size.X, size.Y, size.Z, NULL);
Well, the collision do works, but it is not happening where it is supposed to.
For example, if I create a box in a high position, it will fall, but the collision with the ground will happen before the mesh touch the ground, and then the box will be floating a few centimeters over the ground.
Is this the right way to read the size of the mesh?
Thanks!
I´m trying to integrate irrlicht with newton, and then I did this:
IrrToNewton = 1/32
//creating the Box
core::aabbox3d<f32> box;
vector3df size;
box = this->meshscenenode->getBoundingBox();
size = box.getExtent() * IrrToNewton;
ncollision = NewtonCreateBox(my_nworld, size.X, size.Y, size.Z, NULL);
Well, the collision do works, but it is not happening where it is supposed to.
For example, if I create a box in a high position, it will fall, but the collision with the ground will happen before the mesh touch the ground, and then the box will be floating a few centimeters over the ground.
Is this the right way to read the size of the mesh?
Thanks!
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
I have a small demo that you might be able to snarf code from:
http://s-fonline.com/webhosting/dhenton ... erdemo.php
Its a bunch of boxes flying in a big box. The big box is created in a separate subroutine, and you might be able to strip the code out to fit your needs. Also, the little flying things use code similar to yours. If you grep the code for "getextent" it might prove useful
HTH
http://s-fonline.com/webhosting/dhenton ... erdemo.php
Its a bunch of boxes flying in a big box. The big box is created in a separate subroutine, and you might be able to strip the code out to fit your needs. Also, the little flying things use code similar to yours. If you grep the code for "getextent" it might prove useful
HTH
etcaptor: Thank you!
I´ll check that out with the guy that created the model for me.
dhenton9000: Hey, I already got your code. That´s pretty cool and I learned a lot from it. But the getboundingbox stuff is very similar, and so I didn´t know what to do.
By the way, what is OpenSteer?
I took a look at their website, but I didn´t get what is it for (my English is not so good).
Thank you all!
I´ll check that out with the guy that created the model for me.
dhenton9000: Hey, I already got your code. That´s pretty cool and I learned a lot from it. But the getboundingbox stuff is very similar, and so I didn´t know what to do.
By the way, what is OpenSteer?
I took a look at their website, but I didn´t get what is it for (my English is not so good).
Thank you all!
My personal choice was to use calculations of offset by bounding box center. That is useful because you can apply it for many free models.
That is not only related with newton. See this screen:
We have a two Irrlicht models - sydney.md2 and DWARF.X with coordinates by x, y, z. Z is !=0 only for second model for good vision
From this view you can foresee immediately what behaviour will get your newton box collision for these meshes.
That is not only related with newton. See this screen:
We have a two Irrlicht models - sydney.md2 and DWARF.X with coordinates by x, y, z. Z is !=0 only for second model for good vision
From this view you can foresee immediately what behaviour will get your newton box collision for these meshes.
Because sometime I'm lazy for coding, for this goal use my VisualEditor - it's free.
You can draw bounding boxes by using of irrlicht function void irr::scene::ISceneNode::setDebugDataVisible ( bool visible )
like
yournode->setDebugDataVisible(true) ;
But this is not related with newton.
You can see dhenton9000 example. There are a functions for drawing of newton collision boxes. Just use it for debuging of your newton collision.
Here is an example with newton debug functions via convexhull collision:
You can draw bounding boxes by using of irrlicht function void irr::scene::ISceneNode::setDebugDataVisible ( bool visible )
like
yournode->setDebugDataVisible(true) ;
But this is not related with newton.
You can see dhenton9000 example. There are a functions for drawing of newton collision boxes. Just use it for debuging of your newton collision.
Here is an example with newton debug functions via convexhull collision: