• 🏆 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!

[Trigger] how to make a parabola?

Status
Not open for further replies.
Level 19
Joined
May 1, 2008
Messages
1,130
i have 2 points and i want a unit to be slideing (sliding trigger) from first poin to second point in a parabola (like a semicircle)
how can i do that?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Here you go, this is what it does:

Circle_01.jpg


  • SemiCircle
    • Events
      • Player - Player 1 (Red) types a chat message containing c1 as An exact match
    • Conditions
    • Actions
      • -------- Unit to move --------
      • Set TempUnit = (Random unit from (Units currently selected by Player 1 (Red)))
      • -------- Starting point --------
      • Set TempLoc1 = (Center of Rect 012 <gen>)
      • -------- Ending point --------
      • Set TempLoc2 = (Center of Rect 013 <gen>)
      • -------- Angle from start to end --------
      • Set TempAngle = (Angle from TempLoc1 to TempLoc2)
      • -------- Radius of the semi-circle --------
      • Set TempReal = (Distance between TempLoc1 and TempLoc2)
      • -------- Halfway point between start and end --------
      • Set TempLoc3 = (TempLoc1 offset by (TempReal / 2.00) towards TempAngle degrees)
      • Trigger - Turn on MoveCircle <gen>
  • MoveCircle
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempReal2 Greater than or equal to 90.00
        • Then - Actions
          • -------- End point reached, turn off and reset values --------
          • Trigger - Turn off (This trigger)
          • Set TempAngle2 = 0.00
          • Set TempReal2 = 0.00
        • Else - Actions
          • Set TempReal2 = (TempReal2 + 1.00)
          • -------- Circle from left side --------
          • Set TempAngle2 = ((TempAngle - 180.00) - (180.00 x (Sin(TempReal2))))
          • -------- Circle from right side --------
          • Set TempAngle2 = ((TempAngle - 180.00) + (180.00 x (Sin(TempReal2))))
          • Unit - Move TempUnit instantly to (TempLoc3 offset by (TempReal / 2.00) towards TempAngle2 degrees)
I was lazy and didn't fix the leaks.

"TempReal2 Greater than or equal to 90.00" is used because sin 90° is 1, and you've done a full semi-circle.

It takes (90/TempReal2Increment)/(1/UpdateTime) seconds to do the semi-circle.

In this example it is (90/1)/(1/0.03) = 2,7 seconds.
 
Status
Not open for further replies.
Top