Z movement(elevation) for the Sine Behavior

New releases and general discussions.

Post » Mon Feb 15, 2010 12:49 pm

You know what I mean :wink: (sorry for the short text - I hate writing)
B
2
G
3
Posts: 51
Reputation: 952

Post » Mon Feb 15, 2010 1:26 pm

This is a great request and all which I'd personally like to see, but shouldn't this really be on the 'Feature requests' board?
B
2
S
2
G
3
Posts: 143
Reputation: 1,536

Post » Mon Feb 15, 2010 4:24 pm

In the meantime, put a dummy sprite offscreen with a y value of 0 and give it the Sine behaviour with vertical movement..

Then just

Always - set Z elevation (of main sprite) to dummy sprite.y

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Mon Feb 15, 2010 5:06 pm

+ System: Sprite.Value('num')%2 Equal to 0
-> Sprite: Set Z elevation to Sprite.ZElevation+1
+ System: Else
-> Sprite: Set Z elevation to Sprite.ZElevation-1

+ System: Every 5000 milliseconds
-> Sprite: Add 1 to 'num'

3 events with a private variable
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Mon Feb 15, 2010 7:20 pm

newt that would make a saw wave?

set sprite z elevation to:

sin((timer+{offset})*{period scaler})*{range}

this has pretty much everything you need to do what the sine movement does in its entirety. randomizations require a second step, but first let me explain the different {fancy bracket stuff}

those are all adjustable parameters.
offset, will be a number from 0-359 anything higher or lower will just make it harder to read because of loop-back in the phase.


this parameter will act like the offset in the sine behavior, except its not in percentage.
if you wanna know how much of a percentage of offset it is, simply check what your desired offset over 360 is. like an offset of 90, would be 90/360=1/4= 25% i assume your smart enough to figure out what a desired percentage would be (cross multiply some stuff i dont feel like explaining it its simple math)

the {period scaler} adjusts the length of the period. i think timer is always gonna be running at millisecond speed. so it normally takes 360 milliseconds to complete a full period (again all has to do with sine phase) if you have a period scaler of .5 itll take 720 milliseconds, because itll be half as slow, and of course a scaler of 2 will take 180 milliseconds. if you wanna have an exact amount of time

i think you would have to do this to get it
desired length in millisecs/360

and use that as the period scaler parameter

range parameter is simply, well... range.

if you wanna randomize things, use private variables for each of the parameters, and at startup
add a random(x) to the desired starting value.

thats pretty much all you need to know to mimic sine behavior, its really not all that complicated if you know what you're doing.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Mon Feb 15, 2010 7:29 pm

[quote="Shady":31q3fc7l]This is a great request and all which I'd personally like to see, but shouldn't this really be on the 'Feature requests' board?[/quote:31q3fc7l]

Yes it should... moving thread.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Feb 15, 2010 9:35 pm

[quote="QuaziGNRLnose":5frxq7yx]newt that would make a saw wave?[/quote:5frxq7yx]

Nope it makes a sine, its the same speed going up as it is going down.
What it is is a simple toggle, simple to implement, and simple to understand.
btw you might post an example of your formula in action... I assume your smart enough to figure that out.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Mon Feb 15, 2010 11:56 pm

sine isnt same speed going up as it is going down thats a triangle wave. sine is the length of the vertical side of a right triangle with hypotenuse of length 1 at an angle X.

heres an example, tracing an ellipse through 3d space with a combination of my technique for sine movement through Z elevation (or any parameter) and a real sine behavior for the y movement.

http://dl.dropbox.com/u/1010927/zsinemov.cap


i made a mistake in my post its 360/milliseconds.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Tue Feb 16, 2010 12:35 am

Yeah, and that would be really noticeable if it were on the x, or y axis.

Also I guess somebody should mention that an addition to the sine behavior probably wont happen, since z(currently) is a sprite object dimension. It is the only object set up for it.
Not that you couldn't fake it for other objects.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Tue Feb 16, 2010 2:59 am

[quote="newt":2z3miret]Also I guess somebody should mention that an addition to the sine behavior probably wont happen, since z(currently) is a sprite object dimension. It is the only object set up for it.
Not that you couldn't fake it for other objects.[/quote:2z3miret]
The SDK allows you to set the Z-elevation of any object, but it's up to the plugin developer to actually draw the objects with Z-elevation. Since the sprite is the object most commonly used with this behavior, it would be a helpful feature addition.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests