Point2point constraint damping

Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Point2point constraint damping

Post by Mako_energy02 »

As the title suggests, I'm wondering if there is any way to apply damping to an objects motion while it's on a point2point constraint attached to world space. I'm implementing some click and drag functionality and any time the object is being manipulated by the mouse it goes haywire. This is partially to be expected, but it doesn't seem to relax after a short period of time. Is there a setting to apply damping to the object to help it come to rest(Ideally that doesn't inhibit the objects motion in other cases)?
Last edited by Mako_energy02 on Wed Jul 06, 2011 10:34 pm, edited 1 time in total.
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: Point2point constraing damping

Post by dphil »

Are you trying to attach the object to the mouse (or rather a point in world space representing the mouse) with a constraint to move it around? And once released the constraint is removed?

A couple ideas...

With constraint:
1) increase linear/angular damping just while it is being dragged, then revert it once released
2) Perhaps the constraint is too short, such that the body can not attain a "resting" length/position and flails around.

Without constraint:
2) Simulate the constraint by applying forces on the dragged body in the direction of the mouse (we do this in our simulations, and it's pretty smooth, although the object floats around a bit and doesn't stick to the mouse precisely). The force would also need to be adjusted for the mass of the object and other external forces like gravity.
3) Temporarily turn off gravity (if it exists) for the body and simply translate it to the mouse location (its proxy in world space). We also have a pick/drag mode for this (in addition to the "force drag" option mentioned above), which works decently.
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Point2point constraing damping

Post by Mako_energy02 »

I have actually recently resolved this somewhat. It's down to a tolerable level at least. It seems we were doing the math wrong when doing our raycasts to see if we had hit an object. We are using a constraint, and we have a plane vertical plane that we use to determine the world coordinates of where we want the constraint to go. The faulty raycasts caused it to jerk around a bit more then it should have. It's not completely gone, but it's manageable now. If it persists or I want to eliminate it completely we'll try to apply angular damping only while it's being dragged. Thanks dphil.