Topic: about the "updateSimulation()" methode

Hi, I work currently on a 3D pathfinding and I have a question about physics simulation :
How make severals collisions tests in a row ("d'affilée") ?

I think there is one collision simulation / frame / 3Dobject,  the methode "updateSimulation()" can make another collision simulation ?

Last edited by Alinor (2012-01-17 19:33:56)

Re: about the "updateSimulation()" methode

Sorry, I'm not sure to understand your question,
what do you want to do ?

Je ne suis pas sur de comprendre, qu'es-ce que tu veux faire ?

updateSimulation is to update simulation tick.

Re: about the "updateSimulation()" methode

En fait pour savoir par exemple si un personnage est en face d'un mur, je comptais utiliser un cube en "ghost" et lui faire adopter différentes positions autour du personnage en réalisant à chaque fois un test de collision afin de définir au mieux son environnement.

Le problème c'est que j'ai l'impression que si on fait un test de collision, qu'on déplace le cube et que juste après on refait un autre test de collision, le deuxième test renverrait la même valeur que le premier, ainsi je me demandais si updateSimulation() résoudrait mon problème.

Last edited by Alinor (2012-01-18 10:28:33)

Re: about the "updateSimulation()" methode

Le cube en ghost ne rentre pas en collision avec le personnage ?
Par exemple, pour la boite "Feet" dans YoFrankie exemple, on détecte la collision avec le sol si le nombre de collision est supérieur à 1 car la boite rentre aussi en collision avec le Player.

int nbCollision = physics->isObjectInCollision(phyProps->getCollisionObjectId());

updateSimulation() doit être appelé par la classe MGame dans update() comme fait par défaut.

Re: about the "updateSimulation()" methode

anael wrote:

Le cube en ghost ne rentre pas en collision avec le personnage ?

je pense résoudre ce problème, soit en évitant au cube de passer au travers du personnage, soit en utilisant
isObjectsCollision (phyPropsCube->getCollisionObjectId(), phyPropsPerso->getCollisionObjectId())
et décrémenter de 1 si true wink

pour revenir à mon problème de pathfinding, si par exemple un mur se trouve à (4,0,0)  devant le personnage en (0,0,0), le cube étalon aurait un coté de 1.

int TABCollision [10];
cube->setPosition(1,0,0);
TABCollision [0] = physics->isObjectInCollision(phyPropsCube->getCollisionObjectId());
cube->setPosition(2,0,0);
TABCollision [1] = physics->isObjectInCollision(phyPropsCube->getCollisionObjectId());
cube->setPosition(3,0,0);
TABCollision [2] = physics->isObjectInCollision(phyPropsCube->getCollisionObjectId());
cube->setPosition(4,0,0);
TABCollision [3] = physics->isObjectInCollision(phyPropsCube->getCollisionObjectId());

Est-ce que le tableau TABCollision contiendra les valeur 0,0,0,1 (mettons 1,0,0,1 si le personnage est compté dans la première collision) ?

Last edited by Alinor (2012-01-18 11:33:58)

Re: about the "updateSimulation()" methode

For those of use that don't speak french.

Alinor:
In fact such as whether a character is in front of a wall, I intended to use a cube "ghost" and make him adopt different positions around the character by making every time a crash test to define the best environment.

The problem is that I feel that if we make a crash test, which moves the cube and just after we redo another crash test, the second test would return the same value as the first, and I wondered if updateSimulation () would solve my problem.



anael:
The cube ghost does not come into collision with the character?

For example, the box "Feet" in YoFrankie example, it detects the collision with the ground if the number of collisions is greater than 1 because the box also comes into collision with the Player.

int nbCollision = physics->isObjectInCollision(phyProps->getCollisionObjectId());

updateSimulation () must be called by the class in MGame update () as the default.



Alinor:
I think solving this problem, either by avoiding the cube to get through the character, or by using
isObjectsCollision (phyPropsCube-> getCollisionObjectId (), phyPropsPerso-> getCollisionObjectId ())
and decrement of 1 if true to return to my problem of pathfinding, if such a wall is (4,0,0) before the character (0,0,0), the cube next to a standard one would.

int TABCollision [10];
cube->setPosition(1,0,0);
TABCollision [0] = physics->isObjectInCollision(phyPropsCube->getCollisionObjectId());
cube->setPosition(2,0,0);
TABCollision [1] = physics->isObjectInCollision(phyPropsCube->getCollisionObjectId());
cube->setPosition(3,0,0);
TABCollision [2] = physics->isObjectInCollision(phyPropsCube->getCollisionObjectId());
cube->setPosition(4,0,0);
TABCollision [3] = physics->isObjectInCollision(phyPropsCube->getCollisionObjectId());

Does the table contain the value TABCollision 0,0,0,1 (1,0,0,1 put if the character is counted in the first collision)?

Last edited by zester (2012-01-18 11:37:41)

Re: about the "updateSimulation()" methode

Ok,

you cannot do like you do and change the box position and expecting the collision test to update,
the best way is to create 4 boxes from the beginning.

The collision test is not real-time like that, isObjectInCollision returns the current frame collision detection (faster).

If you want to test a real-time collision detection (which is not the best idea) you can use Maratis functions that are not using the physics engine :

- isRaytraced in : http://code.google.com/p/maratis/source … eshTools.h
- isBoxToBoxCollision, isPointInBox... in : http://code.google.com/p/maratis/source … s/MMaths.h

Re: about the "updateSimulation()" methode

Ok, I think I understand, thanks for the answer (and thanks zester for the translation wink)

Re: about the "updateSimulation()" methode

Alinor wrote:

Ok, I think I understand, thanks for the answer (and thanks zester for the translation wink)

Not a problem just thought your question was valuable, and figured the rest of the community could benefit from the
conversation. And I understand that explaining a problem is easier to do in your native language.

Sooooo Anytime wink