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

JASS Shapes

Status
Not open for further replies.
Level 14
Joined
Jun 27, 2008
Messages
1,325
that kind of stuff is usually done by moving dummyunits which have the model of the desired effects. Moving the units is done by teleporting them periodically (setting their position using a periodic timer with like 0.03 seconds timeout).

To form the shape you just need to find an expression for the x,y,z values (or x(t), y(t), z(t) functions). This requires some basic math knowledge, but nothing difficult.

Example for a circle with radius r u just use x(t) = r * cos(t), y(t) = r * sin(t), to change the angular velocity multiply the argument of sin and cos with a factor.

To make a spiral use the same expressions and add z(t) = t * v_z with v_z being the speed in z direction. Looks like this:
http://www.wolframalpha.com/input/?i=ParametricPlot3d[{Cos[t]%2C+Sin[t]%2C+t%2F6}%2C+{t%2C+0%2C+30}]
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
JASS:
globals
	//counts the steps
	integer i
	//x,y of start position
	real xStart
	real yStart
	//x,y of each step
	real xD
	real yD
	//the dummy
	unit dummyUnit
endglobals

function move takes nothing returns nothing
	if i < 100 then
		set i = i + 1
		call SetUnitX(dummyUnit, xStart + xD * i)
		call SetUnitY(dummyUnit, yStart + yD * i)
	else
		call DestroyTimer(GetExpiredTimer())
	endif
endfunction

function shockwave real x, real y, real angle returns nothing
	set i = 0
	set xStart = x
	set yStart = y
	set xD = cos(angle)
	set yD = sin(angle)
	call TimerStart(CreateTimer(), true, 0.03, function move)
endfunction

math:
x(t) = xStart + xD * t
y(t) = yStart + yD * t
or with vectors:
(x, y)(t) = (xStart, yStart) + (xD, yD) * t
 
Status
Not open for further replies.
Top