Announcement

Collapse
No announcement yet.

How to rotate a spot light towards the mouse cursor in TopDown?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to rotate a spot light towards the mouse cursor in TopDown?

    Hello!

    In the TopDown Template I attached a spot light to my character, to use it as a flashlight ingame. I created a new socket for the flashlight and selected that as the parent socket for the spotlight.

    Now I want my flashlight to shine (look) at the mouse cursor position, since my character is already always facing the cursor (and I am shooting at the cursor position). However I can't get it to work and I am beginning to despair..

    This is what I want:
    Click image for larger version

Name:	flashlight-rotation-problem2.jpg
Views:	1
Size:	69.7 KB
ID:	1225116

    And this is my function to rotate the flashlight:
    Click image for larger version

Name:	flashlight-rotation-problem.jpg
Views:	1
Size:	270.6 KB
ID:	1225118

    What am I doing wrong?
    I tried to use 'Set Relative Rotation' node and attached only the Pitch or Roll, but nothing is working.

    Please help me..
    Attached Files

    #2
    I solved the problem by using an event tick that I connect to the 'Set World Rotation' Node (and by moving the function into the Event Graph).

    However I wonder if this is actually a good solution? Or is there another way without using an event tick?

    Comment

    Working...
    X