[Newton 2.0] Simple formula

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[Newton 2.0] Simple formula

Postby frankk » Mon Nov 03, 2008 7:36 pm

Hi,

it's me again but this time, I do not wanna ask you about the custommultibody vehicle.
I just wanna know a simple formula :

How to determine the main axis (direction) of a 3D body out of the matrix that newton gives us. This direction must also be relative to something, but how to calculate it ?

Thanks in advance for taking time to answer to this simple newbie 3D question.
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: [Newton 2.0] Simple formula

Postby frankk » Tue Nov 04, 2008 11:02 am

In other words, how to get the yaw, pitch and roll ?
frankk
 
Posts: 32
Joined: Thu Oct 09, 2008 2:40 pm
Location: Quebec, Canada

Re: [Newton 2.0] Simple formula

Postby Julio Jerez » Tue Nov 04, 2008 11:30 am

That depend, what do you need it for?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [Newton 2.0] Simple formula

Postby JernejL » Tue Nov 04, 2008 1:27 pm

Perhaps NewtonGetEulerAngle is what you need.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [Newton 2.0] Simple formula

Postby Dave Gravel » Tue Nov 04, 2008 10:35 pm

If you need it from the matrix you can do it like this.
I don't have test it with all situation but working good for me.

Code: Select all
function GetMatrixTurnAngle(mat: Tmatrix): single;
begin
  result :=radtodeg(-arctan2(-mat[2,0], mat[0,0]));
end;

function GetMatrixPitchAngle(mat: Tmatrix): single;
begin
  result :=radtodeg(-arctan2(-mat[1,2], mat[1,1]));
end;

function GetMatrixRollAngle(mat: Tmatrix): single;
begin
  result :=radtodeg(-arcsin(mat[1,0]));
end;
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 24 guests

cron