P
P
p4p2019-03-24 17:27:48
C++ / C#
p4p, 2019-03-24 17:27:48

Rotate the radar needle (2D object) towards the target (3D object). How to implement?

The arrow is implemented as a simple 2D object with a picture. The player puts a mark in the form of a 3D object and the arrow should turn towards this mark. Some LookAt from 2D to 3D. Any ideas? Rotation of the arrow relative to the player's position.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2019-03-24
@p4p

actually for the transition from 3d to 2d
https://docs.unity3d.com/ScriptReference/Vector3.P...
you have
-player position.
- the position
of the label easily get the direction vector to the label.
if higher or lower does not interest. we make a projection onto a horizontal plane - we get a point (or rather a direction) - where to turn the arrow.
Another option is to compare the direction to the label and the forward direction of the player.
we get as a result "to the right" "to the left" "behind" and so on. and on 2D just display.
what exactly is the problem anyway?
make at least an initial attempt at implementation (if it’s easier, then just a 3d arrow / stick towards the mark), and there you can already correct it)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question