[ODE] Pushing an object.

Jon Watte (ODE) hplus-ode at mindcontrol.org
Mon Jan 2 14:03:43 MST 2006


The best behavior is had when you consider the mouse position as a 
desired target location.

Calculate where the moved object would be at some time dt in the future, 
forward extrapolated from the current position and linear velocity. 
Subtract this position from where the target position (user's mouse) is. 
This is the vector you need to accelerate. Scale this by some 
appropriate tuning factor (times the mass of the object) and apply that 
as a force to the object.

There are two tunables: the force multiplier, and the time dt into the 
future. I would recommend an initial dt of 0.1 - 0.2 seconds for 
interactive work, and a correspondingly fairly large force multiplier -- 
the smaller the dt, the larger the necessary force (there are obviously 
limits here).


Also, you should probably make the object that the user moves 
artificially heavy while the user is moving it, to make sure that you 
aren't trying to push away a giant rock using a fly swatter. That's 
never going to work right!

Cheers,

			/ h+


Peter Onion wrote:
> On Mon, 2006-01-02 at 17:03 +0100, Thomas Paviot wrote:
> 
>>Hello and happy new year,
>>
>>Maybe the stability problem comes from the fact that you set linear 
>>velocity of the reel. Did you try to add a force proportional to the 
>>difference between the reel's position and the mouse cursor's position 
>>(like a linear spring)?
> 
> 
> Yes I did, but that was worse because depending on the size of the reel
> the "error force" either made the reel "fly off" (small reels) or had to
> be huge before it over came friction to start the motion (large reels).
> 
> 
>>The motion control can be easily achived if the trajectory is simple :
> 
> 
> It's not simple as it is determined by the user moving the mouse about !
> 
> 
>>[SNIP]
>> 
>> ODE doesn't provide such a joint but you can create a new one.
> 
> 
> I have plenty of other things to work on right now LOL.
> 
> Peter
> 
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
> 
> 


More information about the ODE mailing list