Weird Body behavior and crash

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Weird Body behavior and crash

Postby Julio Jerez » Wed Mar 13, 2019 9:35 am

that won't be the function, look for the places where the game call function
Code: Select all
void NewtonBodyGetRotation(const NewtonBody* const bodyPtr, dFloat* const rotPtr)
{
   TRACE_FUNCTION(__FUNCTION__);
   dgBody* const body = (dgBody *)bodyPtr;
   dgQuaternion rot = body->GetRotation();
   rotPtr[0] = rot.m_x;
   rotPtr[1] = rot.m_y;
   rotPtr[2] = rot.m_z;
   rotPtr[3] = rot.m_w;
}


you will se that before it was
rotPtr[0] = rot.m_w = rot.q0;
rotPtr[1] = rot.m_x = rot.q1;
rotPtr[2] = rot.m_y = rot.q2;
rotPtr[3] = rot.m_z = rot.q3;
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Weird Body behavior and crash

Postby Sweenie » Wed Mar 13, 2019 10:19 am

In OgreNewt_Body.cpp , line 215.
Code: Select all
NewtonBodyGetRotation(body, &me->m_curRotation.w);

Newton now has the layout x,y,z,w
Ogre has w,x,y,z

Something like this should fix it...
Code: Select all
float ori[4];
NewtonBodyGetRotation(body, &ori[0]);
me->m_curRotation.w = ori[3];
me->m_curRotation.x = ori[0];
me->m_curRotation.y = ori[1];
me->m_curRotation.z = ori[2];


or maybe this way is better
Code: Select all
NewtonBodyGetRotation(body, &me->m_curRotation.w);
float temp = me->m_curRotation[3];
me->m_curRotation[3] = me->m_curRotation[2];
me->m_curRotation[2] = me->m_curRotation[1];
me->m_curRotation[1] = me->m_curRotation[0];
me->m_curRotation[0] = temp;
Sweenie
 
Posts: 490
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Weird Body behavior and crash

Postby Lax » Wed Mar 13, 2019 3:14 pm

Thank you very much, that was exactly the issue, now everything is working as expected!
Lax
 
Posts: 116
Joined: Sat Jan 08, 2011 8:24 am

Re: Weird Body behavior and crash

Postby Julio Jerez » Wed Mar 13, 2019 3:18 pm

say in ting ting y un ting tang :D for not reason, I just made that up.
Julio Jerez
Moderator
Moderator
 
Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Weird Body behavior and crash

Postby Lax » Wed Mar 13, 2019 3:39 pm

I do not know what that means, but it sounds somehow funny :D :D
Lax
 
Posts: 116
Joined: Sat Jan 08, 2011 8:24 am

Previous

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest