Is there any way to find a particular object and move towards that object ?
Currently, I’m using Vector3.Lerp to move towards, and I want it to move towards, lets say, an object named ObjectA.
However, there are a few such objects in the scene, so is there a way to access each ObjectA ?
I’ve checked out instanceID to find the unique id, however, from what I read, the instanceIDs will be different when you load a new level and then come back to it (correct me if I’m wrong).
if you want an object to move towards certain objects in the AI script of that object create a var of type Transform to hold the ObjectA(target)'s position and in code have the object turn and move towards that object. Now if there are multiple objects that are potential targets either have the moving object raycast a ray and if that ray hit a target move towards that target or determine which target to move towards by calculating distances between the moving object and the target.
However, the player object seems to ‘jump’ immediately to ObjectA’s position without showing it slowly movin towards that position. I’ve tried Time.deltaTime too but both doesn’t seem to work.