[SOLVED]When character's dimensions are set, problem happens

lexchou

16-08-2007 14:34:20

PhysX SDK: 2.7.2
NxOgre: 0.9-33 (from SVN)
OGRE: 1.4.3(Eihort)


Problem 1
I use a zombie mesh from OgreNewt, when I do not set the dimensions and the character's node's scale, everything works fine, but if I use them both, a problem happens, parts of the body(below the zombie's knees) are underneath the terrain, when I set the second number to less (like 1) or greater(like 40), the case gets worse.

The code:

NxOgre::Character *character=scene->createCharacter("Player",NxOgre::Pose(Vector3(1710,160,310)),"type: box, Density: 100, dimensions: 20 20 20");
character->attachMesh("zombie.mesh");
character->getNode()->setScale(20,20,20);
character->setDirection(Quaternion(Degree(-90),Vector3::UNIT_Y));


I haven't find exact description about the dimensions, what is it about? scale or size?


Problem 2
How does the parameter stepoffset effect the character? whatever I set, nothing different. If I want to control the character's movement speed, should I modify the code of Character::simulate ?

Problem 3
When I use a Character instead of a Actor, and when it's dropping from a higher place, the Character falls obviously slower than Actor, what's wrong?


Thank you!

betajaen

16-08-2007 14:48:00

1.

Your Zombie is 20 metres high, unless you want it to be like that. You should set it to a sensible height like 2. However I suspect the Zombie mesh isn't centered properly. You could adjust this by adding a second node in the character node to counter act the offset.

2.

It's just how high the capsule/box floats above the ground. It's used for going up steps, uneven ground or slopes better.

And no, you should never modify character. Use a CharacterMovementVectorController instead, there are plenty of examples around here to show you how to use it.

3.

Simple Characters aren't Actors. The gravity code for Characters is mine, so it's no where near as good as Ageias.

Rambo

19-08-2007 12:57:21

2. Your stepoffset look like this -> 0 x 0 and sometimes it's wrong.
Change this to x 0 0 or 0 0 x.

betajaen

19-08-2007 13:08:46

Step offsets in CharacterParams are floats, not Vector3's ;)

Rambo

19-08-2007 13:51:22

hmm.. :P it's weird cose I use float and i don't work

betajaen

19-08-2007 13:56:27

Then the entire parseReal() in Ogre is wrong then, because it is a float.

But just use the proper way of using Params, it's faster:

CharacterParams p;
p.setToDefault();
p.mType = CharacterParams::CT_Box;
p.mDimensions.set(0.25f,2.0f,0.25f);
p.mStepOffset(0.25f);

...

scene->createCharacter(....., p);

Rambo

19-08-2007 14:16:54

OK... I reinstal and rebuild all... you are right it's float. Maybe my changes in your NxOgre make this anomaly ;).