Page 1 of 1

Create world with specific parameters

Posted: Wed Feb 04, 2015 1:37 pm
by nikolaiko
Hi.
I work with BEPUPhysics some time and already created a simple location with characters. But, I faced another problem now. I need to create some specific behavior for the player characters and I don't know how to achieve it (I am using CharacterController).

1.I need player to start/stop right after press/release direction keys. I press left - robot start moving left, with the desired speed (not accelereating from 0 to speed). I release key - robot stop. If I moving left and then press right, for example, robot start move right with no delay. I used HorizontalMotionConstraint to set direction, but it doesn't change direction right after pressing button. After changing direction robot still moving to old direction, changing direction step-by-step it is right in terms of physics, but I need different behavior. So, I started to set body directly LinearVelocity. Looks like it worked.

2.Speed of the character is fast enougth. And then I start moving robot just start flying, literaly, after a few steps. I can take off from small hill. I tried to increase mass then creating character controller to 99999, but it doesn't help. Maybe I am doing something wrong?

I can publish a video to show how it works now, if it helps.

Thanks.

Re: Create world with specific parameters

Posted: Wed Feb 04, 2015 6:02 pm
by Norbo
1.I need player to start/stop right after press/release direction keys. I press left - robot start moving left, with the desired speed (not accelereating from 0 to speed). I release key - robot stop. If I moving left and then press right, for example, robot start move right with no delay. I used HorizontalMotionConstraint to set direction, but it doesn't change direction right after pressing button. After changing direction robot still moving to old direction, changing direction step-by-step it is right in terms of physics, but I need different behavior. So, I started to set body directly LinearVelocity. Looks like it worked.
Change the CharacterController.TractionForce to a very high value. This will make the character accelerate essentially instantly when the character has traction with the ground. If you want to always accelerate instantly even when in the air or sliding, change the AirForce and SlidingForce too.
2.Speed of the character is fast enougth. And then I start moving robot just start flying, literaly, after a few steps. I can take off from small hill. I tried to increase mass then creating character controller to 99999, but it doesn't help. Maybe I am doing something wrong?
This is probably due to setting the linear velocity directly. For example, if you set the velocity to (5,0,5) every frame, the entity will not be able to accelerate due to gravity, since the vertical velocity gets reset to 0 every frame.

Re: Create world with specific parameters

Posted: Fri Feb 13, 2015 12:38 pm
by nikolaiko
Hey, thanks, Norbo.

Sorry for delay, I just tried options you suggest they working well, so I am playing around with some parameters and keep working on creating needed behaviour.

Re: Create world with specific parameters

Posted: Mon Feb 16, 2015 10:11 am
by nikolaiko
Hi, again! I tried to change TractionForce an SlidingForce to huge values and now my character start and change direction really fast. But as result I have some bad effects. So, I have an quaestion about space settings again. Is where any ways to create a world without any physics properties? No friction, no bounce and so on. Just collision detection and maybe gravity, if it possible. I just want to create a "clear" space without any properties that can affect movement in the "background". Is it possible?

Thanks.

Re: Create world with specific parameters

Posted: Mon Feb 16, 2015 6:39 pm
by Norbo
For material properties, you could set the MaterialManager.MaterialBlender to a delegate that always returns 0 coefficients regardless of input. This would have the same effect as setting every object's material properties to zero coefficients.

You would also want to set each entity's LinearDamping and AngularDamping to 0; there is no global-ish setting for this.