Path-Creator icon indicating copy to clipboard operation
Path-Creator copied to clipboard

Moving an object along the path based on Input?

Open mspacemedia opened this issue 5 years ago • 2 comments

What would be the best(easiest) route to having an object move along the path based on Input interaction? I would assume that the path would need to be set to 0-1 from start to end point?

mspacemedia avatar Oct 12 '20 09:10 mspacemedia

I did it like this: if(Input.GetKey(KeyCode.Space)) { distanceTravelled += spd * Time.deltaTime; transform.position = pathCreator.path.GetPointAtDistance(distanceTravelled, end); } In this case, pressing the spacebar will move the object along the path.

ZenyteFury avatar Feb 02 '21 10:02 ZenyteFury

Thanks @ZenyteFury I ended up using iTween but will take another look at Path Creator for my next project 👍

mspacemedia avatar Feb 02 '21 10:02 mspacemedia