• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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