2
\$\begingroup\$

I've played Metroid Blast on Wii U, and would like to build one of its features in a three.js game.

The feature is: if an opponent is out of view, a guide is displayed showing the direction of the opponent.

An example of it is here:

enter image description here

(Image source)

Notice the small circles with arrows in the left side.

How could I have a similar feature in my game?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

For each opponent/object/destination to display:

  • Project it's worldspace location to view-space (MV)
  • Flatten the Z to 0
  • Normalize the direction to unit-length
  • Multiply by "HUD" radius (world/view-space units)
    (the linked image looks like they might have used aspect ratio, instead, to stretch circle into an ellipse)
    (i.e. scale by (widthFactor, heightFactor, 0) instead of 1.0f)

enter image description here

I may not be able to provide the code to "find opponents within the proper range" (using three) (I'm betting you can)

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.