Page 2 of 2

Re: Improve the character movement

Posted: Sat Aug 06, 2011 10:39 pm
by Norbo
The engine is unitless. You are responsible for giving the numbers meaning.

However, it is best to keep the final values of numbers within a reasonable range. Picking values between 0.5 and 10 for the dimensions of individual objects is a good idea and helps to avoid numerical precision issues. Floating point numbers cannot represent every real number.

I usually use a value from 1.7 to 2 or so for character height. This roughly corresponds to a real life person's height in meters, but there's nothing fundamental about the fact that I call it meters. The important thing is that the objects in the game turn out to have sizes within a reasonable range, around 0.5 to 10 preferably. Since a character usually interacts with objects with a size on a similar order of magnitude, this works out well.

Re: Improve the character movement

Posted: Sat Aug 06, 2011 10:41 pm
by alfarza
another thing Norbo , I can now use the drawer code to see my capsule , can I see my capsule in wire frame mode ?

Re: Improve the character movement

Posted: Sat Aug 06, 2011 10:46 pm
by Norbo
Yup, the model drawer has an IsWireframe property.

Re: Improve the character movement

Posted: Sat Aug 06, 2011 11:49 pm
by alfarza
I use this line "modelDrawer.IsWireframe = true;" but every thing i see in the wire frame , i need only the capsule ?

Re: Improve the character movement

Posted: Sun Aug 07, 2011 12:00 am
by Norbo
A model drawer does not discriminate between individual objects :) You could draw other stuff independently, or possibly even use a second ModelDrawer instance.

Re: Improve the character movement

Posted: Sun Aug 07, 2011 12:04 am
by alfarza
what is the support heigh for ? "SCC = new SimpleCharacterController(new Vector3(0, 100, 0), 90, 25, ? , 85);"

Re: Improve the character movement

Posted: Sun Aug 07, 2011 12:07 am
by Norbo
That is the distance above the ground that the bottom of the character's body floats. The character is supported by a ray cast below that. The character will be unable to step up obstacles that have a height greater than the support height.

Re: Improve the character movement

Posted: Sun Aug 07, 2011 12:19 am
by alfarza
I tried many value like 1 , 20 and 100 but there is no difference , i cant step on sidewalk only if i had a higher velocity . how can i fix the problem ? :mrgreen:

Re: Improve the character movement

Posted: Sun Aug 07, 2011 12:28 am
by Norbo
Is the step actually a slope? The character controller is designed not to walk on things which are too steep.

It's easy to directly know whether or not it's a problem with the character's support height. If the obstacle is some height X that is greater than the support height, then the support height needs to be increased. This can be easily eyeballed with proper debug rendering. If the support height and character is correct, then it's probably a slope issue or other geometry problem.

Re: Improve the character movement

Posted: Sun Aug 07, 2011 12:40 am
by alfarza
whate do u mean with slope , right now i have a small height on sidewalk (the picture in first page) .
and i don't know if u mean sliding movement , right now I have a sliding with walk too ??
and what is the geometry problem ??

Re: Improve the character movement

Posted: Sun Aug 07, 2011 12:46 am
by Norbo
It sounds like you need to make sure all your debug rendering is correct, and then use it to ensure everything is where you expect it to be and where it needs to be. The character should float off the ground by the support height. This support height must also be high enough to climb over any obstacle you wish him to overcome, like a step.

If the entire world is gigantic, with steps 15 units tall, but the support height is only 1, it will be unable to step on anything. In this case, the best option is to scale the world down so everything is consistent with the recommended range of values (0.5 to 10 units per object dimension, roughly). Such inconsistent scaling is one possible 'geometry problem' that I referred to.

Re: Improve the character movement

Posted: Sun Aug 07, 2011 12:56 am
by alfarza
maybe because I use this line to increace the gravity "SCC.Body.LinearVelocity += new Vector3(0, -10, 0);"
when I replace this value by 0 i can step with easily but the gravity will be weak .

Re: Improve the character movement

Posted: Sun Aug 07, 2011 1:00 am
by Norbo
The weakness of gravity is probably because of excessive scale relative to gravity, high linear damping, or a combination of the two. Excessive scale is bad and should be addressed directly regardless. High linear damping is unnecessary when using the SimpleCharacterController; it will decelerate inappropriate motion automatically.

Remove any code setting linear damping to higher-than-default values, rescale if necessary, keep the gravity at a regular amount, and don't apply superfluous downward velocities. Things should work a lot better.