Problem with Character Detection

alejandro

26-05-2007 00:35:34

how can i now when the character colide with a specific body that is part of a group?

is there any way set a callback for the character control.

betajaen

26-05-2007 00:39:08

1. In 0.9 no, in 0.6 I believe yes, but I can't remember how.

2. In 0.6 no, in 0.9 yes, again I can't remember the code.

alejandro

26-05-2007 23:53:28

no , with 0.4 ,
i need to know the type of the body .

betajaen

26-05-2007 23:55:12

Then no then.

alejandro

27-05-2007 00:08:14

my character is walking normaly and, he find a tree , in wich he can go up, what do you advice , or how can i know when he find the tree, i think the best is with colision .... :(

betajaen

27-05-2007 00:15:32

In 0.9, when the code is completed you'd be able to use a CharacterTrigger to limit the motion of the character to up and down only.

You could do a similar thing now, and just manually check if the character controller is within the radius of the tree, and just control the motion of the character yourself.

alejandro

29-05-2007 23:18:53

now , i more close to solved .
i im using the variable hit , from the class character controler , when it call the function NxControllerAction character::onShapeHit(const NxControllerShapeHit& hit)

i save the hit value in hitt , so is public

so i my app, i used and i did this :

if (mPlayer->mColision()){

if ( mPlayer->hitt.shape->getActor().getGroup() == 10)
{

// code here
}

}

// in the setup of the scene
NxActorGroup grupo = 10 ;
bodyArbolTrepar->mActor->setGroup( grupo );

si it work :) so , the weird thing , is when i add this to the body

bodyArbolTrepar->freezeAll(); , it do not enter to the "if" ,
"(// code here ) " :(

so , i dont know

ricardo_arango

30-05-2007 06:29:55

NxGroup is just an int then.

alejandro

30-05-2007 16:32:21

NxActorGroup grupo = 10 ;

10 is just the number of my group

alejandro

30-05-2007 21:14:32

i hate to be so persistance

but i need to do this !!!

so i asume that nobody needs to know with what is the character controler colliding ???? :(

jchmack

05-06-2007 09:32:46

i hate to be so persistance

but i need to do this !!!

so i asume that nobody needs to know with what is the character controler colliding ???? :(


i had the same problem and the feature that you need will be implemented in the future. But for now I use the characters node position and just check the distance between that and the point of collision.

For my ladders/ your trees:
1)Make a temporary node at the bottom of your tree.

2)If the character is within x meters of your tree node remove the NX character and just use an entity to represent it.

3)Change movement controls so that your character can only move up and down. Or Sideways if needed for walls and stuff.

4)create a node at the top of the ladder.

5) use the same collision method to detect if he has hit this node.

6) switch back to the NXcharacter.

I believe this is how most pro games do it... they have a "climb mode" I dont know the nature of your game but in most cases you dont need the physics calulations for your character when you are climbing.

If you want like an FPS type climb(characters can just run up ladders) vs a Third person climb you will just have to wait until Betajaen get Controller collision callbacks up. Until then you could try to implement it yourself. It's not as hard as it seems his code is pretty readable when he wants it to be.

On a side note you are using an OLD version of NXOgre. People can more accurately help you if you are using code that they are using now. I understand that you may have your reasons for not upgrading (i believe i remember you being worried about character movement issues) But you cant expect everyone to remember all the details of 0.4.

betajaen

05-06-2007 09:58:04

It's implemented in 0.9 using the BaseCharacterHitReporter class, which amongst things handles what to do in an event of a collision but from there you can have your own code to detect collision with certain things.

It's even better since you can have multiple of these running per Controller System.