- Home /
Moving set distance over set time in local space
I want to move objects a set distance over a set amount of time, all in local space while their parent object is rotating and moving around in world space. I'm having trouble figuring out how to do this combination of things.
I've got it working with Transform.Translate, except that I can't get the translation to happen over a fixed period of time. Vector3.MoveTowards also almost works, but I can't figure out how to get it working in local space, I get something mixed up and get all kinds of crazy results. I might just need a little clarifying to get my code straight.
How would you do this?
You should not use Transform.Translate to move an object, dependent on your game, as it does not work well with colliders. Ins$$anonymous$$d, AddForce to a Rigidbody and check if the distance between the point you aim for and your object's Transform is smaller than a certain value, then remove the force from the Rigidbody.
Answer by nicholasjramsey · Feb 09, 2017 at 02:23 AM
Actually I got it! Remembered time = distance / speed....
Your answer
Follow this Question
Related Questions
Local 'forward' 3 Answers
I Can't Assign Something To Local Space's X Axis 1 Answer
LOCAL Trail Renderer 1 Answer
Create variable based on local axis 1 Answer
Rotate and transform in local space 2 Answers