Hi
I use the script below to move a target (objectToMove) up and down on screen, following the finger.
This works well, however, the start stop motion is hard, and I’d like to soften it, e.g. when i stop moving my finger, or stop touching the screen, the objectToMove will slow down to a stop rather than hard stop.
I’ve tried to incorporate SmoothDamp but I can’t get that to work… obviously I’m not understanding it correctly. So I’m hoping someone might be able to point me in the right direction for this.
Thanks
if (ChangeInY < 0)
{
movementDirection = -1;
while (objectToMove.transform.position.y > 0) //clamping
{
objectToMove.transform.Translate (directionYDown * Time.deltaTime*objectSpeed, Space.World);
}
}
else if (ChangeInY > 0)
{
movementDirection = 1;
while (objectToMove.transform.position.y < 570)
{
objectToMove.transform.Translate (directionY * Time.deltaTime*objectSpeed, Space.World);
}