Detetct what part of object am I clicking

Hi, I have an earth globe in a level and I want to detect which continent the player clicks in order to select a map to play on. How can I detect the clicks? Im guessing I can make 2d particles that go onto the continents and detect clicking those, but in that case how can I assign (or even create) those particles to those continents so they get locked onto the earth, because the earth is also spinning? Sorry for the question being complicated, I tried my best.

1 Like

How did you create the continents?

Just a texture. I can remake it if needed.

1 Like

If you use a line trace, you get the coordinates returned

If you’re just clicking using the mouse cursor, you can convert that to world coordinates

Once you have a point in the world you can convert it to a point on the globe using a bit of math. You still have to figure out what country that is! :smiley:

It may or may not be easier to just cover the relevant regions of the globe with collision boxes and then you know where it was clicked. You can parent the boxes to the globe to make sure they move with it.

I think @Everynone’s answer will be better. You can also find out what part of the texture you’ve clicked in…

Can I make the collision boxes continent shaped?

1 Like

Nope :wink:

well im guessing i can model all the continents into seperate objects and trace under mouse cursor by channel > break hit result > hit actor > branch if hit actor has interface “continent” then just detect which continent you clicked

but is it overcomplicated / beginner way?

1 Like

Here you go ( assuming you’re using the mouse cursor )

Then you can figure out what continent you’ve hit from the UV coords :slight_smile:

For this to work, you need this project setting

image

1 Like

I tried it, but I have no idea what comes after getting the UV… Yea, I’m most certanly a noob in ue5.

1 Like

It’s an X and Y between 0 and 1. It’s the location in the texture :slight_smile:

So now just figure out which continent is at these coordinates?

1 Like

It might be the easiest way…

It depends on a lot, like how finely you want to break things up.

1 Like

I am trying to get it to detect mouse input but it does not work because UI seems to get input priority. I want the player to be able to interackt with the globe as well as be able to go back using a button on the screen.

Input mode game and UI…

(post deleted by author)

But now the button doesn’t work. Input works, but the button is unclickable + every time I click mouse cursor disappears for a split second and appears again

1 Like

It’s hard to know exactly what you’re doing, but if you’re switching between the world, it will be a combination of the 3 ‘set input mode…’ nodes.