Resizing Newton Bodies

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Resizing Newton Bodies

Postby rabbit » Fri May 01, 2009 9:49 pm

Is it possible to resize a newton body after it is created?

The ideal interface I would like to have would be similar to the following

cube->setSize( 2, 2, 2);
rabbit
 
Posts: 18
Joined: Fri Mar 27, 2009 7:01 am

Re: Resizing Newton Bodies

Postby Dave Gravel » Fri May 01, 2009 11:55 pm

Yes but if I remember it working only with convex shape, anyway on this case your not so limited.
Only terrain can cause problem, on this case you scale the vertices and recreate the collision.

Just a exemple of what you need for rescale a convex.
Code: Select all
  Modifier:=NewtonCreateConvexHullModifier(Manager.World,Collision);
  NewtonBodySetCollision(Body,Modifier);
  NewtonReleaseCollision(Manager.World,Modifier);
  NewtonConvexHullModifierGetMatrix(Modifier,@scaleMatrix[xX,xX]);
  cv:=oxV3Make(BaseObj.UserData.Scale.X,BaseObj.UserData.Scale.Y,BaseObj.UserData.Scale.Z);
  scaleMatrix:=GLSSclMatrix(scaleMatrix,cv[xX],cv[xY],cv[xZ]);
  NewtonConvexHullModifierSetMatrix(Modifier,@scaleMatrix[xX,xX]);
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 9 guests

cron