# [Trigger]how to make a parabola?

Status
Not open for further replies.

#### raid1000

Level 19
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?

#### Maker

Level 37
Here you go, this is what it does:

• 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.

Replies
11
Views
900
Replies
15
Views
1K
Replies
8
Views
882
Replies
1
Views
529
Replies
9
Views
750