how to move objects along a curve?
Hi!How to move objects along a curve? I need move car along curvre with correct rotation(car should not move sideways or backwards) Thanks.
Answer by spinnerbox · Sep 30, 2015 at 02:48 PM
The question is a bit old but this beautiful tutorial has all you need: http://catlikecoding.com/unity/tutorials/curves-and-splines/
Its a bit hard at the beginning but you will develop your own tool to edit a spline curve and make a cube travel along the curve.
I found that tutorial with a google search a while back and I agree it is very useful. A bit difficult at first for beginners but if you read it slowly you'll figure it out in no time.
Answer by Berenger · May 01, 2012 at 05:38 PM
It depends how your curves is defined. If it is a succession of waypoints, you need the logic to move from one waypoint to another and the logic change the target when you're close enough.
If it's more like a bezier curve, the position will depend on a a variable "t" based on the speed you desire and the length of the curve.
Either way, the orientation is going to be toward the movement's direction, probably using Quaternion.LookRotation and Vector3.lerp / Time.deltaTime.
Good luck.
Hi, i have script BeizerCurve - but it doesn't work on android
Your answer
Follow this Question
Related Questions
Make the character move along a curved road. 0 Answers
MotionBlur 0 Answers
Moving forward based off of Rotation 3 Answers
Third person Character can't move in rotated direction 0 Answers