jchmack
17-01-2008 17:22:45
I am trying to get my character to crouch and be able to go through smaller areas that he normally wouldn't be able to access. I'm not seeing a way to change the height of the controller after creation.
I am thinking that the only way to achieve this is to edit nxogre to allow me to access mcharacter in the character class and change between two NxCapsuleControllerDesc. One for standing the other for crouching.
Or i could have 2 characters always running around and just have only one colliding.
gah i feel im looking too deep into something this simple. But i am seeing no easy way to make my character crouch. Thanks for all help in advance =).
i am using:
NxOgre (NxOgre 0.9-38 ) Started, working with:
- PhysX => 2.7.2
- Ogre => 1.4.5 'Eihort'
- Platform => Windows
betajaen
17-01-2008 17:58:32
You'll have to open up mCharacter or at least bug me to add a getNxCharacter function.
Then use the "setExtents" function on it. Theoretically it should immediately change, but according to the SDK manual it won't check for collisions if you decide to stand up in the middle of a tunnel (and go back to the old extents), and most likely you'll get stuck.
jchmack
18-01-2008 02:11:52
ok im thinking i can just raycast to test if i can stand back up. So that shouldn't be a problem. Im about to edit nxogre and try out setExtents. Thanks again.
jchmack
18-01-2008 02:25:21
ok im not seeing a setextents in either of these:
CharacterController* mCharacterController;
NxController* mCharacter;
I even did a search in the entire nxogre solution and it doesnt find it.
I searched for NxCharacter too and it only found it as an include in NxOgreCharacter.cpp
Maybe its the bleeding code that uses the nxcharacter. Im betting I am using the legacy character you mentioned.
betajaen
18-01-2008 09:28:37
No, it should be there. It's setExtents is part of the NxBoxController, and setHeight/setRadius for NxCapsuleController. You should be able to cast myCharacter->getNxController() into either one of those depending on the shape.
jchmack
18-01-2008 18:42:06
ok i'm a bit further. Now i have a change size function:
void Character::setCapsuleSize(float height,float radius)
{
NxCapsuleControllerDesc* Temp = (NxCapsuleControllerDesc*)mCharacter;
Temp->height = height;
Temp->radius = radius;
}
but it doesn't seem to do what i want... if i call this:
mCharacter->setCapsuleSize(CharacterCrouchHeight,CharacterRadius);
it seems to just zero my characters z position... any ideas why? Looking at the remote debugger gives no hints either it just.... teleports him...
jchmack
18-01-2008 18:48:01
bah i think i got it:
NxCapsuleControllerDesc -> NxCapsuleController
too much copy paste..... I am surprised it didn't crash it.
edit: sigh now i get the crash when i call it:
void Character::setCapsuleSize(float height,float radius)
{
NxCapsuleController* Temp = (NxCapsuleController*)mCharacter;
Temp->setHeight(height);
Temp->setRadius(radius);
}
jchmack
22-01-2008 18:01:03
bump...
does anyone know why this is crashing when i call it? I am using:
NxOgre (NxOgre 0.9-38) Started, working with:
- PhysX => 2.7.2
- Ogre => 1.4.5 'Eihort'
- Platform => Windows
void Character::setCapsuleSize(float height,float radius)
{
NxCapsuleController* Temp = (NxCapsuleController*)mCharacter;
Temp->setHeight(height);
Temp->setRadius(radius);
}
betajaen
22-01-2008 18:29:20
I can't really test it out (my character code is pretty much blank), but are you sure "Temp" is not zero, or it's cast correctly?