Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by SFCBias » Thu Jul 08, 2010 9:17 am
Im using Ogre and ive managed to create system of loading entities with information about wut kinda of collisions to use for them. But when i debug the collisions are not lined up with the entities. Im not sure how to manually set the position and orientation of the body/colliison. Also im not using OgreNewt. I've tried taking the position/orientation from Ogre and converting to a float[16] matrix with the correct position but if i call NewtonBodySetMatrix it doesn't do anything to the body's position. Maybe im using the wrong function?
-
SFCBias
-
- Posts: 54
- Joined: Tue Jun 22, 2010 12:40 am
- Location: Hephzibah,GA
by JernejL » Thu Jul 08, 2010 3:03 pm
NewtonBodySetMatrix definetly sets body orientation & position properly, ensure that the matrix you specify for it is a correct 4x4 matrix.
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Julio Jerez » Thu Jul 08, 2010 3:24 pm
Ogre use a non conventional 4 x 3 matrix where newton uses a normal OpenGl/Direct3d 4 x 4 matrix
you can probably borrow the OgreNewt to convertion runtines.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by SFCBias » Thu Jul 08, 2010 9:37 pm
That actually what i did using a a float matrix rather than Ogre's matrix.
-
SFCBias
-
- Posts: 54
- Joined: Tue Jun 22, 2010 12:40 am
- Location: Hephzibah,GA
by SFCBias » Sun Jul 11, 2010 9:48 pm
Given the matrix, lets say 'm' for example, m[12] = x m[13] =y and m[14] = z coordinates. Im still quite lost on this, i use the OgreNewt conversion method here. I simple put the code into my class.
- Code: Select all
void PhysX::PhysXTools::QuatPosToMatrix(const Ogre::Quaternion& _quat,
const Ogre::Vector3 &pos, float* matrix)
{
// this takes a Quaternion and a Vector3 and creates a float array
// which is more meaningful to Newton.
Matrix3 rot;
Vector3 xcol, ycol, zcol;
Ogre::Quaternion quat(_quat);
quat.normalise();
quat.ToRotationMatrix(rot); // creates a 3x3 rotation matrix from the Quaternion.
xcol = rot.GetColumn(0);
ycol = rot.GetColumn(1);
zcol = rot.GetColumn(2);
// now fill the final matrix with the appropriate data:
matrix[0] = xcol.x;
matrix[1] = xcol.y;
matrix[2] = xcol.z;
matrix[3] = 0.0f;
matrix[4] = ycol.x;
matrix[5] = ycol.y;
matrix[6] = ycol.z;
matrix[7] = 0.0f;
matrix[8] = zcol.x;
matrix[9] = zcol.y;
matrix[10] = zcol.z;
matrix[11] = 0.0f;
matrix[12] = pos.x;
matrix[13] = pos.y;
matrix[14] = pos.z;
matrix[15] = 1.0;
}
-
SFCBias
-
- Posts: 54
- Joined: Tue Jun 22, 2010 12:40 am
- Location: Hephzibah,GA
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 6 guests