Historique des modifications - Message

Message #7360

Sujet: [Newton 2.xx]Créer une collision entre 2 cubes


Type Date Auteur Contenu
Création du message 15-11-2009 16:29:50 nico
A oui c'est vrai, j'avais pas pensé qui y avait newton dans N3XTD, je vais voir ça dessuite wink

Aussinon pour les fonctions de callback, c'est celles des tuto que j'ai essayé de mettre à jour pour que ce soit compatible avec la version 2.10.

Code c++ :

void _cdecl Objet::SetMeshTransformEvent(const NewtonBody* body, const float* matrix,int)
{
	// copy the matrix into an irrlicht matrix4
	matrix4 mat;
	memcpy(mat.pointer(), matrix, sizeof(float)*16);

	// Retreive the user data attached to the newton body
	ISceneNode *tmp = (ISceneNode *)NewtonBodyGetUserData(body);
	if (tmp)
	{
		// Position the node
		tmp->setPosition(mat.getTranslation());		// set position
		tmp->setRotation(mat.getRotationDegrees());	// and rotation
	}
}

void _cdecl Objet::ApplyForceAndTorqueEvent (const NewtonBody* body,float timestep, int threadindex)
{
   float mass;
   float Ixx;
   float Iyy;
   float Izz;
   float force[3];
   float torque[3];

   NewtonBodyGetMassMatrix (body, &mass, &Ixx, &Iyy, &Izz);

   force[0] = 0.0f;
   force[1] = NEWTON_GRAVITY * mass;
   force[2] = 0.0f;

   torque[0] = 0.0f;
   torque[1] = 0.0f;
   torque[2] = 0.0f;

   NewtonBodyAddForce (body, force);
   NewtonBodyAddTorque (body, torque);
}

Retour

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
190 invités en ligne
membre en ligne: -
RSS Feed