Some damping

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
mr_join
Posts: 14
Joined: Fri Nov 01, 2013 10:03 am

Some damping

Post by mr_join »

Hi !
I try to create some damping to the door. Door is - RevoluteJoint + Box with offset,
So, the door is openning by right click + change mouse position :

Code: Select all

float dY = mouseState.Y - Camera.Viewport.Height * 0.5f;
dY = dY * Camera.Speed * dt;
float total = currDoor.GetJointSide() == Vector3.Right ? -dY : dY;
currDoor.ConvexHull.AngularVelocity = new Vector3(0, total, 0);
if (mouseState.RightButton == ButtonState.Released)
   currDoor.ConvexHull.AngularVelocity = Vector3.Zero;
(Not real code, only simple vers).
Soo. And a question is : has a way to reallize damping after some mouse acceleration when the right click release ?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Some damping

Post by Norbo »

The simplest way would be to set the door entity's AngularDamping to a higher value. The value corresponds to what fraction of momentum the entity will lose in one second.
mr_join
Posts: 14
Joined: Fri Nov 01, 2013 10:03 am

Re: Some damping

Post by mr_join »

i tryed it. if i set angular damping in val = 1f door not move at all.
if val = 0 - damping rarely work; reeeeally rarely;
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Some damping

Post by Norbo »

if val = 0 - damping rarely work; reeeeally rarely;
Setting damping to 0 corresponds to not losing any momentum at all (outside of the deactivation system's low velocity stabilization). Values between 0 and 1 are allowed. 0.5 would remove about half the momentum in a second.
mr_join
Posts: 14
Joined: Fri Nov 01, 2013 10:03 am

Re: Some damping

Post by mr_join »

Thx Norbo. )
Post Reply