How to get the bounding box to create a newtonbox?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Mercator
Posts: 16
Joined: Fri Jan 27, 2006 4:31 pm

How to get the bounding box to create a newtonbox?

Post by Mercator »

I'm using Newton for my physics, but I don't know how to give Newton the bounding box of my animated mesh.

This is the function I have to call:

Code: Select all

NewtonCollision* NewtonCreateBox(
const NewtonWorld* newtonWorld,
dFloat dx,
dFloat dy,
dFloat dz,
const dFloat *offsetMatrix) 
Create a box primitive for collision. 

Parameters
const NewtonWorld *newtonWorld  - is the pointer to the Newton world.  
dFloat dx  - box side one x dimension.  

dFloat dy  - box side one y dimension.  

dFloat dz  - box side one z dimension.  

const dFloat *offsetMatrix  - pointer to an array of 16 floats containing the offset matrix of the box relative to the body. If this parameter is NULL, then the primitive is centered at the origin of the body.  




Return
Pointer to the box 

Remarks
Collision primitives are reference counted objects. The application should call NewtonReleaseCollision in order to release references to the object. Neglecting to release references to collision primitives is a common cause of memory leaks. Collision primitives can be reused with more than one body. This will reduce the amount of memory used be the engine, as well as speed up some calculations. 
Could anybody give me a short example of how to get the bounding box of my animated mesh and call this function in the right way? You can set the last parameter to NULL. I just don't know how to handle with the dimension-parameters.
Thanks.
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

I have a sample up on irrforge.org

http://irrforge.org/index.php/Simple_Ne ... ht_Example

Also i have several newton/irrlicht examples at http://s-fonline.com/webhosting/dhenton9000/items
Mercator
Posts: 16
Joined: Fri Jan 27, 2006 4:31 pm

Post by Mercator »

GREAT!! THANKS!

Everything works!
Your game "newt8" detects a buffer overrun after loading the mesh "assets\wallswitch_mod.obj", but helpful code!
Post Reply