Aiming with the right joystick, weapon not pointing towards in-game pointer [SOLVED]

Hello. I am making a side-scrolling platformer, and I would like to have right stick aiming. I am trying to do this by rotating the weapon (represented in the test project by the green arrow) towards an in-game pointer object (dark red circle), controlled by instant forces applied when the joystick is pushed in a direction.
I have layered this pointer on a layer above the rest of the game (‘Top’), and it seems that the weapon is pointing towards a separate object, I am guessing this is because the pointer is actually in a different place, and the layering is just visual. This is the issue I would like to fix.
I have attached screenshots of a test project, any help is much appreciated. Thank you!

(The green arrow should be pointing at the dark red circle)

I am not sure i follow
If your goal is to have red circle point to where you gonna shot by whatever direction your right joystick is pressed in then you need to
1 - add action to put object around another object
And put red circle around your player
2 - make two variables call them Range and Direction
3 - in angle you put variable Direction in distance you put variable Range
4 - if joystick is not pressed then you change Range to 0
If it is pressed (or more likely pulled into any direction) you set it to WHATEVER distance from player you would wish to have
You need to test what value will be good for you i would start from 20
5 - if up is pressed you set variable Direction to 270
Down 90
Left 180
Right 0

And that would be pretty much it

BTW last thing to do is to rotate green arrow toward red circle
And there is action to rotate object toward another

Thanks, I was trying to implement the mechanic in an inferior way, that being to have a pointer on screen that is not locked to any center, constrained within the screen borders. I will use the method you have presented instead. Your help is much appreciated, thanks again.

1 Like