How to get or set body's final transform properly?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

How to get or set body's final transform properly?

Postby donggas90 » Sat May 16, 2015 6:36 am

Now I seeing dNewtonBody for wrapping.
but confusing to get or set body's final transform.
In 101 demo, using InterpolateMatrix to get position. and it's same with GetVisualMatrix.
BTW, what about GetMatrix? though it's faster then InterpolateMatrix, why demo does not use this?
and how about direct access dNewtonTransformLerp's members?
Thanks.
donggas90
 
Posts: 9
Joined: Mon May 11, 2015 12:02 pm
Location: Busan, Republic of Korea

Re: How to get or set body's final transform properly?

Postby JoeJ » Sat May 16, 2015 9:16 am

GetMatrix returns the real state of the body, the other functions do interpolation in case graphics update at another rate than physics.
Note that you should always run physics with a fixed timestep like 1/60 second.
But if graphics run somewhere between 40 and 80 fps, sometimes you need to do 2 or none physics steps per frame to sync to real time.
To compensate this and render smooth looking motion for physics bodies, you can interpolate / extrapolate or integrate the bodies to match framerate, and this is what those other functions do.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: How to get or set body's final transform properly?

Postby donggas90 » Sat May 16, 2015 10:01 am

JoeJ wrote:Note that you should always run physics with a fixed timestep like 1/60 second.

Oh, I didn't know about that.

Thanks for reply.
donggas90
 
Posts: 9
Joined: Mon May 11, 2015 12:02 pm
Location: Busan, Republic of Korea


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron