- Home /
Distance between a gameObject and a direction vector.
Hello. I'm trying to find the distance between a game object and a direction vector in 3D. I repeat not the distance between two gamobjects or two vectors. Distance between a gamobject and a directional/normalized vector is what I desire to find. Any help is much appreciated!
Comment
The length of a normalized vector is, by definition, always 1. What exactly is the relationship between this direction and the object? Where is the origin in this case? Is the direction co$$anonymous$$g from the object itself?
Answer by RaidingShaman · Apr 27, 2020 at 08:32 AM
Simply do it. Unity has its special scipt. Assign it in tge gameobject. float distance = Vector3.Distance (transform.position, direction);