• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Mouse rotation system don't get right angle

Status
Not open for further replies.
Level 6
Joined
Aug 28, 2015
Messages
213
Hello everyone I tried and failed now to make a camera system where you click on the floor and rotate around your unit by dragging the world around in relation to the mouse courser as the fix point.
The thing is it kind of works sometimes, especially when you keep the mouse clicked and draged for a long time but when I try to rotate in many small steps it fails.

Suggestions and Helping ideas are more then welcome.

Edit: Solved
I post here the trigger if someone want to use this system.
No credits needed but if you feel like giving them I appreciate;)

  • ClickDown
    • Events
      • Player - Player 1 (Red) issues Mouse Down event
    • Conditions
    • Actions
      • Set IsClicked = True
      • Set OldRotation = (Angle from CameraPosition to (Mouse Position for Triggered Mouse Event))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • OldRotation Greater than 360.00
        • Then - Actions
          • Set OldRotation = (OldRotation - 360.00)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • OldRotation Less than 0.00
        • Then - Actions
          • Set OldRotation = (OldRotation + 360.00)
        • Else - Actions
  • ClickUp
    • Events
      • Player - Player 1 (Red) issues Mouse Up event
    • Conditions
    • Actions
      • Set IsClicked = False
  • Drag
    • Events
      • Player - Player 1 (Red) issues Mouse Move event
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsClicked Equal to True
          • (Mouse Position X for Triggered Mouse Event) Not equal to 0.00
          • (Mouse Position Y for Triggered Mouse Event) Not equal to 0.00
        • Then - Actions
          • Set NewRotation = (Angle from CameraPosition to (Mouse Position for Triggered Mouse Event))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NewRotation Greater than 360.00
            • Then - Actions
              • Set NewRotation = (NewRotation - 360.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NewRotation Less than 0.00
            • Then - Actions
              • Set NewRotation = (NewRotation + 360.00)
            • Else - Actions
          • Set CameraRotation = (CameraRotation - (NewRotation - OldRotation))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CameraRotation Greater than 360.00
            • Then - Actions
              • Set CameraRotation = (CameraRotation - 360.00)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CameraRotation Less than 0.00
            • Then - Actions
              • Set CameraRotation = (CameraRotation + 360.00)
            • Else - Actions
          • Set OldRotation = NewRotation
          • Camera - Set Player 1 (Red)'s camera Rotation to CameraRotation over 0.60 seconds
        • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top