# swinging continuous motion

Member Posts: 16
edited December 2014

I have randomly spawned actors (para-troopers) falling down from the top of the screen with the Accelerate behavior.

I want to make them "swing" from side to side:

1. How to pivot from the top of the parachute? so far it seems creating an asset with top half transparent is the easiest solution.

2. I'm using the "rotate to angle" to rotate once to the left, then again to the right.. but it will not continue. Is there a way to create a "while" loop?

3. Using "rotate to angle" will rotate without a nice animated ease. I tried to figure out how to incorporate the "interpolate" behavior, but I need the "relative to actor" thingy because all the while the actor is "falling down"

• London, UK.Posts: 12,822

@shylevari said:
I have randomly spawned actors (para-troopers) falling down from the top of the screen with the Accelerate behavior.

I want to make them "swing" from side to side + nice animated ease

Constrain X position to:

90 *cos(60 *sin( self.Time *100)-90)+512

Constrain Y position to:

90 *sin(60 *sin( self.Time *100)-90)+384

Constrain Rotation to:

(60*sin( self.Time *100)-90)+90

. . . . . . .

The '512' and '384' values are just the location of the swinging object, change these values to whatever you need - obviously if you object is falling the Y value ('384') will need to be an attribute that is decreasing (example: (800- self.Time *100) )

The '60' is the angle of swing.

The self.time *100 is the speed of the swing.

• London, UK.Posts: 12,822

@shylevari said:
i wanted to add an ever increasing variable to make the paratroopers fall faster over time

Simply change the '384' location value to whatever you need. If you want the actor move down the screen then decrease this value over time.

• Member Posts: 16

since the soldiers are supposed to be spawned at different x positions, the two top formulas arent helpful (they are all spawned at the same position. using the random makes everything .. weird..)

but the rotation formula works great and is infact what i wanted

thanks alot!!

• London, UK.Member Posts: 12,822
edited December 2014

@shylevari said:
since the soldiers are supposed to be spawned at different x positions, the two top formulas aren't helpful

There are not multiple formulas here, this is all one formula, you need to use these three constrain behaviours in conjunction with each other.

@shylevari said:
(they are all spawned at the same position)

You can spawn the actor wherever you like. Like I say "The '512' and '384' values are just the location of the swinging object, change these values to whatever you need" all the spawned actors don't have to be in the same position.

• Member Posts: 16

I used only the constrain rotation line, with a seperate (accelerate) behavior and i like the result

I dont understand how i can spawn a new actor in a different location each time using this code

• London, UK.Member Posts: 12,822

@shylevari said:
I dont understand how i can spawn a new actor in a different location each time using this code

Simply change the '512' and '384' location values to whatever you need.

Example:

http://www.mediafire.com/view/3ndkgwnk84s050m/parachute_swing.zip

• Member Posts: 16

@Socks‌ tnx for the file
the result is desireable - but the math is beyond my comprehension
i wanted to add an ever increasing variable to make the paratroopers fall faster over time

i couldn't figure where to place it. i assume it's on the constrain y position rule, related to self.time.
near the first one it made the paratroopers wobble faster (but not fall faster), and near the second one it made the paratroopers spawn lower on the screen - but not fall faster

again - tnx for the file, but the math is beyond me
i prefer to stay with what i know and understand (and hope pivoting will be an added feature for game salad in the future!)