Newton Game dynamics Wrapper for VB6
Hello peolple
i'm making a wrapper for VB6. I even suceed in adding callbacks functions from VB6. All the code work well.
But when i add more than 80 BOXES i have an error in function
NewtonUpdate (nWorld, timeStep);
I use very basic code from Tutorials that are in the Newton SDK.
Here is the code logic:
I code simple structure that will handle Rigid body imformation
Code:
typedef struct NEMO_PHYSXDATA
{
NEMO_VECTOR Position;
NEMO_MATRIX Rotation;
NEMO_VECTOR RotationEULER;
NEMO_QUATERNION RotationQuat;
NEMO_VECTOR Velocity;
NEMO_VECTOR LinearVelocity;
NEMO_VECTOR AngularVelocity;
NEMO_VECTOR SizeExtent;
NEMO_VECTOR Inertia;
float Density;
float Mass;
int BODY_TYPE;
int IS_PLANE;
}NEMO_PHYSXDATA ;
after i Initialize Newton
i create a body like
Code:
#define VBCALL __declspec(dllexport) __stdcall
int VBCALL NEWTON_InitCreateBox(NEMO_VECTOR &position,NEMO_VECTOR &BoxSize,NEMO_VECTOR &inertie,float Mass,NEMO_PHYSXDATA &RetDATA,bool Mobile)
this function returns the object ID (from 0 .... 1 .. ..2 .... .n where n=number of bodies) -1 means an error
then at update time i call
Code:
void VBCALL DoPhysX(float DT,NEMO_PHYSXDATA *RetDATA,int NUMZ)
dFloat timeStep=(float)DT;
dFloat matrix[4][4];
dFloat euler[3];
// update the Newton physics world
/////HERE IS THE ERROR WHEN MY BODIES NUMBER IS OVER 80 under
the code just runs WELL
NewtonUpdate (nWorld, timeStep);
for (int I=0;I<NUMZ;I++)
{
NewtonBodyGetMatrix(MyBODYZ->m_pBody,&matrix[0][0]);
NewtonGetEulerAngle(&matrix[0][0],euler);
RetDATA.RotationEULER.x=(float)euler[0];
RetDATA.RotationEULER.y=(float)euler[1];
RetDATA.RotationEULER.z=(float)euler[2];
/*NewtonBodyGetVelocity(MyBODYZ->m_pBody,&euler[0]);
RetDATA.LinearVelocity.x=(float)euler[0];
RetDATA.LinearVelocity.y=(float)euler[1];
RetDATA.LinearVelocity.z=(float)euler[2];
NewtonBodyGetOmega(MyBODYZ->m_pBody,&euler[0]);
RetDATA.AngularVelocity.x=(float)euler[0];
RetDATA.AngularVelocity.y=(float)euler[1];
RetDATA.AngularVelocity.z=(float)euler[2];*/
RetDATA.Position.x=(float)matrix [3][0];
RetDATA.Position.y=(float)matrix [3][1];
RetDATA.Position.z=(float)matrix [3][2];
}
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement