Sign in to follow this  

Newton Game dynamics Wrapper for VB6

Recommended Posts

BIGPOPA    122
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[I]->m_pBody,&matrix[0][0]); NewtonGetEulerAngle(&matrix[0][0],euler); RetDATA[I].RotationEULER.x=(float)euler[0]; RetDATA[I].RotationEULER.y=(float)euler[1]; RetDATA[I].RotationEULER.z=(float)euler[2]; /*NewtonBodyGetVelocity(MyBODYZ[I]->m_pBody,&euler[0]); RetDATA[I].LinearVelocity.x=(float)euler[0]; RetDATA[I].LinearVelocity.y=(float)euler[1]; RetDATA[I].LinearVelocity.z=(float)euler[2]; NewtonBodyGetOmega(MyBODYZ[I]->m_pBody,&euler[0]); RetDATA[I].AngularVelocity.x=(float)euler[0]; RetDATA[I].AngularVelocity.y=(float)euler[1]; RetDATA[I].AngularVelocity.z=(float)euler[2];*/ RetDATA[I].Position.x=(float)matrix [3][0]; RetDATA[I].Position.y=(float)matrix [3][1]; RetDATA[I].Position.z=(float)matrix [3][2]; } }

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this