Uncle
Warcraft Moderator
- Joined
- Aug 10, 2018
- Messages
- 7,866
Hello, I'm having trouble trying to get this trigger working. My goal is to have the camera lock to the player's hero, but with some additional options like allowing the camera to extend outwards when you move the mouse towards the edge of the screen. So I basically want a camera deadzone, check out this video for an example:
This trigger isn't finished and barely works but it may help in expressing what i'm trying to achieve. I have 2 dummy units, one is CameraDummy and the other is CameraDummyM. CameraDummy is always moving towards the player's mouse position and will eventually stop once it reaches the mouse position or gets too far away from the hero. During this i'm constantly checking to see if it has moved far enough away from the Hero that we can consider it be out of the "deadzone". Once it's out of the "deadzone" we can start moving the other dummy unit, CameraDummyM, towards the mouse. The player's camera is LOCKED to CameraDummyM, so this gives the effect of a deadzone. In other words, the camera (CameraDummyM) only moves once the mouse (CameraDummy) moves out of the deadzone-which let's say is a 600 radius around the hero.
Sorry if this is confusing, I may be going about this the completely wrong way. The problem with the simpler solutions like just "panning the camera" to the mouse x/y position is that it's extremely jittery and basically unplayable. Making the dummy's move with polar offsets allows for smooth movement. I can't have the camera instantly jumping far distances, it must feel smooth.
The trigger needs a lot of work, but at the moment I can sort of mimic what i'm trying to achieve with it. I attached some pictures that may help. The camera is locked to the small blue orb, while the large blue orb is used to detect the deadzone. In picture 1 the camera hasn't moved because the mouse hasn't moved yet. In picture 2 the camera just started to move because the mouse has left the deadzone (the large blue orb represents your mouse position). In picture 3 the camera has extended out as far as it's allowed to go.
Questions/Issues:
1) How do I "leash" the camera dummy units so that they can't move beyond a certain distance from the hero?
2) How can I deal with the mouse position in regards to hovering over the user interface since this doesn't return a world x/y position?
3) If you know of a better method of going about this and could let me know it would be greatly appreciated.
Thanks for the help!
This trigger isn't finished and barely works but it may help in expressing what i'm trying to achieve. I have 2 dummy units, one is CameraDummy and the other is CameraDummyM. CameraDummy is always moving towards the player's mouse position and will eventually stop once it reaches the mouse position or gets too far away from the hero. During this i'm constantly checking to see if it has moved far enough away from the Hero that we can consider it be out of the "deadzone". Once it's out of the "deadzone" we can start moving the other dummy unit, CameraDummyM, towards the mouse. The player's camera is LOCKED to CameraDummyM, so this gives the effect of a deadzone. In other words, the camera (CameraDummyM) only moves once the mouse (CameraDummy) moves out of the deadzone-which let's say is a 600 radius around the hero.
Sorry if this is confusing, I may be going about this the completely wrong way. The problem with the simpler solutions like just "panning the camera" to the mouse x/y position is that it's extremely jittery and basically unplayable. Making the dummy's move with polar offsets allows for smooth movement. I can't have the camera instantly jumping far distances, it must feel smooth.
-
mouse timer
-
Events
-
Time - Every 0.01 seconds of game time
-
-
Conditions
-
Actions
-
-------- points --------
-
Set heroPoint = (Position of PlayerHero[1])
-
Set mousePoint = (Point(mouseX, mouseY))
-
Set cameraPoint = (Position of CameraDummy)
-
Set cameraMPoint = (Position of CameraDummyM)
-
-------- distance/angles --------
-
Set distanceHeroToMouse = (Distance between heroPoint and mousePoint)
-
Set distanceHeroToCamera = (Distance between heroPoint and cameraPoint)
-
Set distanceHeroToCameraM = (Distance between heroPoint and cameraMPoint)
-
Set angleCameraToMouse = (Angle from cameraPoint to mousePoint)
-
Set angleCameraToHero = (Angle from cameraPoint to heroPoint)
-
-------- movement --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
distanceHeroToCamera Less than or equal to 600.00
-
-
Then - Actions
-
Set movePoint = (cameraPoint offset by 6.00 towards angleCameraToMouse degrees)
-
Set X = (X of movePoint)
-
Set Y = (Y of movePoint)
-
Custom script: call SetUnitX( udg_CameraDummy , udg_X )
-
Custom script: call SetUnitY( udg_CameraDummy , udg_Y )
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
distanceHeroToCamera Greater than or equal to 300.00
-
distanceHeroToCameraM Less than or equal to 300.00
-
-
Then - Actions
-
Set movePoint = (cameraMPoint offset by 6.00 towards angleCameraToMouse degrees)
-
Set X = (X of movePoint)
-
Set Y = (Y of movePoint)
-
Custom script: call SetUnitX( udg_CameraDummyM , udg_X )
-
Custom script: call SetUnitY( udg_CameraDummyM , udg_Y )
-
-
Else - Actions
-
-
-
The trigger needs a lot of work, but at the moment I can sort of mimic what i'm trying to achieve with it. I attached some pictures that may help. The camera is locked to the small blue orb, while the large blue orb is used to detect the deadzone. In picture 1 the camera hasn't moved because the mouse hasn't moved yet. In picture 2 the camera just started to move because the mouse has left the deadzone (the large blue orb represents your mouse position). In picture 3 the camera has extended out as far as it's allowed to go.
Questions/Issues:
1) How do I "leash" the camera dummy units so that they can't move beyond a certain distance from the hero?
2) How can I deal with the mouse position in regards to hovering over the user interface since this doesn't return a world x/y position?
3) If you know of a better method of going about this and could let me know it would be greatly appreciated.
Thanks for the help!
Attachments
Last edited: