• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Shaking camera at a specific point/region

Status
Not open for further replies.
Level 9
Joined
Oct 11, 2009
Messages
477
Is there a way to shake camera only at a give point or region? For example, I shake camera at point X, as the camera goes far from the point, the magnitude also decreases.

+rep for the helper!!!:grin:
 
Well, you would need some system for that, that's for sure. The best way is to use regions and do it like this:
  • Trigger
  • Events
    • Unit - A unit enters (region)
  • Conditions
  • Actions
    • Camera - Shake camera for (Owner of (Triggering unit)) with magnitude 6.00
    • Unit Group - Add (Triggering unit) to CameraGroup
    • Trigger - Turn on Trigger2 <gen>
  • Trigger2
  • Events
    • Time - Every 0.1 seconds of game-time
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (CameraGroup is empty) Equal to False
      • Then - Actions
        • Set Points[1] = (Position of (Picked unit))
        • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then
        • Custom script: set udg_X = GetCameraTargetPositionX()
        • Custom script: set udg_Y = GetCameraTargetPositionY()
        • Custom script: endif
        • Set Points[2] = (X, Y)
        • If (All conditions are true) then do (Actions)
          • If - Conditions
            • (Distance between Points[1] and Points[2]) Greater than 1000.00
          • Then - Actions
            • Unit Group - Remove (Picked unit) from CameraGroup
            • Camera - Stop swaying/shaking camera for (Owner of (Picked unit))
          • Else - Actions
        • Custom script: call RemoveLocation (udg_Points[1])
        • Custom script: call RemoveLocation (udg_Points[2])
      • Else - Actions
        • Trigger - Turn off (This trigger)
  • Trigger3
  • Events
    • Unit - A unit leaves (region)
  • Conditions
    • ((Triggering unit) is in CameraGroup) Equal to True
  • Actions
    • Unit Group - Remove (Triggering unit) from CameraGroup
    • Camera - Stop swaying/shaking camera for (Owner of (Triggering unit))
For smooth effects, you'd need some formula.
 
Status
Not open for further replies.
Top