I have this simple ai waypoint script I just wrote, the slowing down at the end of each segment is annoying, I’d like a linear movement ( or more control of the speed and acceleration).
I read a lot about that problem but couldn’t understand properly how to fix it.
Any help would be welcome, any feedback on the script itself as well.
Thanks
#pragma strict
var points : GameObject[];
private var i:int;
private var curpoint : GameObject;
function Start () {
i=0;
if (curpoint == null) {
curpoint = points*;*
- }*
}
function Update () {
-
if(Vector3.Distance(transform.position, curpoint.transform.position) > 1) {*
-
transform.position = Vector3.Lerp(transform.position, curpoint.transform.position, 0.08);* -
}*
-
else { *
-
if(i < points.length-1) {* -
i= i+1;*
_ curpoint = points*;_
_ }_
_ }_
_}*_
thank you, that worked perfectly
– YanifskaIf your question is solved please accept an answer.
– ExTheSea