Hi, I would like implement this spring and damping effect to my project. I looked into spring equations and Hooke's law (I'm in the exploratory phase) but the info I found doesn't really address the rotation of a vector. The quicktime shows a positional offset but also imagine a rotation influencing the sway and drag of the vector.
Can the vets out their point me in the right direction? What subjects should I google? Is there a good book you recommend? Do you have the working equation that achieves this? I'll take anything. Thanks.
Nikos
spring and damping effect
if you have a rigid body system in place, adding a spring/damper is just adding forces to a rigid body... the rotations will be handled by that automatically.
if you dont have a rigid body system in place... get one .
You can code it yourself (good fun and learning experience) or just grab ODE, PhysX, Bullet, Havok and use theirs.
if you dont have a rigid body system in place... get one .
You can code it yourself (good fun and learning experience) or just grab ODE, PhysX, Bullet, Havok and use theirs.
if you have a rigid body system in place, adding a spring/damper is just adding forces to a rigid body... the rotations will be handled by that automatically.
if you dont have a rigid body system in place... get one .
You can code it yourself (good fun and learning experience) or just grab ODE, PhysX, Bullet, Havok and use theirs.
Using those engines is not an option All I have to work with are 2 vectors. Using these nominal vectors, I would like to calculate a third that represents those spring and drag forces. I thought about doing a simple weighted average of the two using their magnitudes as a weight but it seemed too much like a hack. So I'm appealing to the math gurus on this one. I'll take anything
that doesn't make any sense.
you need to formulate your problem properly or no guru is ever going to be able to help you.
you need to formulate your problem properly or no guru is ever going to be able to help you.
You could apply three one dimensional damped springs, one for each axis. This would give you the "swaying grass" effect you seem to be looking for. Also, this method does not requre a call to sqrt() or other cpu-expensive functions. For each axis, the force F would be F = -x*k - v*d, where x is displacement from rest position along given axis, k is spring stiffnes coefficient, v is velocity relative to rest position along given axis, and d is spring damping coefficient. Along the vertical axis, force would be F = -(x-xr)*k - v*d, where xr is rest distance above ground.
Alternatively, you could apply an angular or rotational spring, but this is considerably more complicated.
Cheers,
Mike
Alternatively, you could apply an angular or rotational spring, but this is considerably more complicated.
Cheers,
Mike
You could apply three one dimensional damped springs, one for each axis. This would give you the "swaying grass" effect you seem to be looking for. Also, this method does not requre a call to sqrt() or other cpu-expensive functions. For each axis, the force F would be F = -x*k - v*d, where x is displacement from rest position along given axis, k is spring stiffnes coefficient, v is velocity relative to rest position along given axis, and d is spring damping coefficient. Along the vertical axis, force would be F = -(x-xr)*k - v*d, where xr is rest distance above ground.
Alternatively, you could apply an angular or rotational spring, but this is considerably more complicated.
Cheers,
Mike
That is exactly what I was looking for. Thanks Mike!
You could apply three one dimensional damped springs, one for each axis. This would give you the "swaying grass" effect you seem to be looking for. Also, this method does not requre a call to sqrt() or other cpu-expensive functions. For each axis, the force F would be F = -x*k - v*d, where x is displacement from rest position along given axis, k is spring stiffnes coefficient, v is velocity relative to rest position along given axis, and d is spring damping coefficient. Along the vertical axis, force would be F = -(x-xr)*k - v*d, where xr is rest distance above ground.
Alternatively, you could apply an angular or rotational spring, but this is considerably more complicated.
Cheers,
Mike
BEAUTIFUL. thanks h4tt3n. works great!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement