Improve the character movement

Discuss any questions about BEPUphysics or problems encountered.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Improve the character movement

Post 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.
alfarza
Posts: 45
Joined: Mon Jul 04, 2011 5:35 am

Re: Improve the character movement

Post 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 ?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Improve the character movement

Post by Norbo »

Yup, the model drawer has an IsWireframe property.
alfarza
Posts: 45
Joined: Mon Jul 04, 2011 5:35 am

Re: Improve the character movement

Post by alfarza »

I use this line "modelDrawer.IsWireframe = true;" but every thing i see in the wire frame , i need only the capsule ?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Improve the character movement

Post 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.
alfarza
Posts: 45
Joined: Mon Jul 04, 2011 5:35 am

Re: Improve the character movement

Post by alfarza »

what is the support heigh for ? "SCC = new SimpleCharacterController(new Vector3(0, 100, 0), 90, 25, ? , 85);"
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Improve the character movement

Post 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.
alfarza
Posts: 45
Joined: Mon Jul 04, 2011 5:35 am

Re: Improve the character movement

Post 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:
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Improve the character movement

Post 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.
alfarza
Posts: 45
Joined: Mon Jul 04, 2011 5:35 am

Re: Improve the character movement

Post 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 ??
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Improve the character movement

Post 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.
alfarza
Posts: 45
Joined: Mon Jul 04, 2011 5:35 am

Re: Improve the character movement

Post 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 .
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Improve the character movement

Post 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.
Post Reply