17-07-2017, 09:40 AM
(17-07-2017, 07:24 AM)chanddu Wrote: Hi josemendez,
Thanks for the reply,can you please tell me how to clamp the force that exerted by the user by pulling the rope?
Regards.
Depends on your particular application. For instance, you can measure how much has the user moved since the last frame, and if the movement is too aggressive do this (pseudocode):
Code:
movementDelta = userPosition - oldPosition;
if (movementDelta.magnitude > threshold)
{
movementDelta = movementDelta.normalized * maxSpeed
}
This gets rid of very fast and sudden movements, forcing user movements to never exceed maxSpeed. But doesn´t prevent the user from pulling too much, albeit slowly. To prevent this, measure the amount of stress in the rope (actualLenght/restLength) and if it's much larger than 1, freeze the user position.