Change Mesh Position

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Change Mesh Position

Postby jcfalcone1 » Wed Dec 03, 2008 7:35 am

I'm seaching a way to change the position of the Mesh position on Newton, because i need to use many terrains on irrlicht and all of the terrain is trimesh in my game...

Have Some function to change the initial position of them?
jcfalcone1
 
Posts: 2
Joined: Wed Dec 03, 2008 7:13 am

Re: Change Mesh Position

Postby JernejL » Wed Dec 03, 2008 10:40 am

Use NewtonBodySetMatrix
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Change Mesh Position

Postby jcfalcone1 » Wed Dec 03, 2008 12:14 pm

i try this my code is this and don't move the trimesh physic position(i'm trying to copy the Irrlicht node position to Newton Physic Body) the Trimesh Stay on 0,0,0 position:

Code: Select all
   this->Collision$ = NewtonCreateTreeCollision(physicWorld$, NULL);

   NewtonTreeCollisionBeginBuild(Collision$);

   this->makeTriMeshData(); // Create the Indices and Vertices

   NewtonTreeCollisionEndBuild(this->Collision$, 0);

   this->Body$ = NewtonCreateBody(physicWorld$, this->Collision$);

   core::matrix4 matrix = this->Node$->getRelativeTransformation();
   core::vector3df origin = matrix.getTranslation() * IrrToNewton;
   matrix.setTranslation (origin);
   NewtonBodySetMatrix(this->Body$, matrix.pointer());
jcfalcone1
 
Posts: 2
Joined: Wed Dec 03, 2008 7:13 am

Re: Change Mesh Position

Postby adam450 » Fri Jan 16, 2009 11:27 pm

You can only modify stuff in a callback function I believe.
adam450
 
Posts: 21
Joined: Fri Jan 16, 2009 11:11 pm

Re: Change Mesh Position

Postby agi_shi » Fri Jan 16, 2009 11:43 pm

^ no, you can modify it anywhere.

And setting the matrix of a tree-collision body works fine for me, what version of Newton are you using?
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Change Mesh Position

Postby adam450 » Fri Jan 16, 2009 11:49 pm

Well then matrix.pointer(), I would check those values to make sure they arent all zero or that the correct matrix entries are set (12,13,14) == (Tx,Ty, Tz)
adam450
 
Posts: 21
Joined: Fri Jan 16, 2009 11:11 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 14 guests

cron