Creating a reusable point-based movement script?

I’m currently using iTween in my game to have objects move around the game world on a pre-definied path, it works well but there are a lot of things that don’t work too well in the context of my game. While it was great to get things up and running I feel I really should write something more specific as it’ll be the basis of my enemy movement for the game.

Ideally I’d like to be able to create a series of empty game objects (similar to the iTween path manager although it wouldn’t necessarily have to be done in the inspector like that) and then have enemies move between these points based on a series of conditions. I’d like to know though what is the best way to move the actual object? These will be animated objects with a rigidbody and collider that act as a trigger. They must correctly set the OnTriggerEnter function on other objects so I think transform.translate would be out of the question because from memory this form of movement ignores some collisions. Would I be best to lerp between points or something else? I’ll either be walking in a straight line between two points or doing a simple arc between two points I won’t need complex splines or anything like that. I think I know how I’m going to set up the point system I just need to the best movement method.

Thanks!

I think that if you have a kinematic rigidbody on the object that needs to enter the trigger, than you can use Translate. Lerp speeds up in the middle of its destination, and looks a little funny for waypoint systems in my opinion.

Does translating only work on a straight line though? Can I choose to translate around an arc instead if need be, I’ve not been able to find examples of this.

Most anything can be done. If you translating between two points on the z/forward, and your looking at your new point. You could just increase or decrease the x value. I think you can use Mathf.InverseLerp or one of the other type mathf classes in order to move out and back some on one axis while traveling from point to point.