- Home /
Finding nearest point
How to find out what is the closest point on a object? I want to know the closest point on a brick (from the mouse), like this (image below), where the red dot is the closest point. When I use Collider.ClosestPoint it will only work when I got my mouse on the brick, which I don't want.alt text The final goal is to know which half of the brick the mouse is closest to, so you can place a brick next to the existing brick.
I'm using Unity 3d Version 2019.3.0f6
Answer by prakyathd801 · Nov 12, 2020 at 12:40 PM
Have you gone through this [Vector3.Distance]
[1]: https://docs.unity3d.com/ScriptReference/Vector3.Distance.html
No, but would this be usefull for
The final goal is to know which half of the brick the mouse is closest to, so you can place a brick next to the existing brick.
I would like to know which half the cursor is closest to. Can this be used for this use?
Your answer
Follow this Question
Related Questions
Why when i move the player object through the door the ontriggerenter/exit event are not fire ? 2 Answers
Change Material depending on Collider position? 2 Answers
FPS all of a sudden gets stuck in floor??? 0 Answers
Connect 2 gameobjects to interact with them simultaneously? 2 Answers
How do you allow the joints in a character to freely fall based on gravity? 1 Answer