Historique des modifications - Message

Message #3208

Sujet: Irrlicht et Newton


Type Date Auteur Contenu
Création du message 27-11-2007 22:23:03 tekilla
resalut voila je poste la ou je me suis arreter avant daller me coucher ^^

NewtonSphere *CGame::MakeSphere(vector3df loc)
{
	NewtonSphere *tmp1 = new NewtonSphere;

	tmp1->mesh = smgr->getMesh("data/sphere.3ds");
	tmp1->node = smgr->addAnimatedMeshSceneNode(tmp1->mesh);
	tmp1->node->setMaterialFlag(video::EMF_LIGHTING, false);
	tmp1->node->setMaterialTexture(0, driver->getTexture("data/wood.jpg"));
	
	// Create a box primitive. 38 is just an estimated value of the size of the model,
	tmp1->collision = NewtonCreateBox(nWorld, 38, 100, 38, NULL);
	tmp1->body = NewtonCreateBody(nWorld, tmp1->collision);

	// Set user data pointer to the scene node
	NewtonBodySetUserData(tmp1->body, tmp1->node);

	// Set body mass & inertia matrix
	NewtonBodySetMassMatrix (tmp1->body, 10.0f, 150.0f, 150.0f, 150.0f);

	// Set the freeze threshhold to 1 unit (default is 0.01 but irrlight uses a large unit scale)
	NewtonBodySetFreezeTreshold(tmp1->body, 1.0, 1.0, 1.0); 

	// Set callback functions for the body
	NewtonBodySetTransformCallback(tmp1->body, SetMeshTransformEvent);
	NewtonBodySetForceAndTorqueCallback(tmp1->body, ApplyForceAndTorqueEvent);

	// Set the position of the body
	matrix4 mat;
	mat.setTranslation(loc);
	NewtonBodySetMatrix(tmp1->body, &mat.M[0]);
	
	if (currentCube == 512)
	{
		printf("* Too many cubes!");
		return NULL;
	}

	Sphere[currentSphere] = tmp1;
	currentSphere ++;

	return tmp1;
}

je reprend demain et je des que je trouve je poste le tout ici smile

bonne nuit XD

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
157 invités en ligne
membre en ligne: -
RSS Feed