PDA

View Full Version : sin movement


hvanzon
03-20-2006, 10:27 PM
im trying to make an object move in a sin wave (in z up down) when you move it in a direction (y for example) with wire parameters.

i tried connecting them with:

x_postion*sin(80) but it moved i a straight line. i cant figures out what i do wrong

sry for my noobness

FaceMn
03-21-2006, 01:51 AM
You need to also adjust the y or z position. Here is a basic sine wave example:

wave_amplitude = 60
wave_width = 10
x_position = 0

for i = 1 to 360 do (
y_position = sin(x_position) * amplitude
x_position += wave_width -- or time, whatever
obj.pos.y = y_position
obj.pos.x = x_position
)


I'm sure there might be more simple examples, but this is just off the top of my head.

hvanzon
03-21-2006, 09:37 AM
it says:

imcompatible types: 0,0 and undifined

tnx for the help and im gonna study the expressions tuts, cos im kinda new to the whole scripting thing. But i think i have to learn it, cos it helps animating things faster.

Aearon
03-21-2006, 09:52 AM
hvanzon i got it to work the way it was suggested in your other thread, the cube sat on it's corner when at 45, and on it's side when at 90, but inbetween it didn't work out right, it didn't really stick to the floor when close to 45

it may be i did something wrong but my guess is the the sin stuff may not be enough

hvanzon
03-21-2006, 01:23 PM
Aeron your absolutely right. It isnt a sin, cos or whatever.

http://harmmaaktmooi.nl/sample/movement.jpg

i made the movement and it comes to this. Is this doable or is it real hard?

hvanzon
03-21-2006, 01:34 PM
btw your Dependency Graph Beta is really cool.

Aearon
03-21-2006, 06:59 PM
thanks man, most of the work is really done by kees' amazing helium plugin, it's just fun scripting on top of that thing, i hope i'll find the time to work some more on this soon


as for this rolling cube thing, actually if you look at it it sure is a circular movement (the path is a quarter of a circle, so coming up with an acurate formula for this should definitely be possible (for someone who know's how to come up with formula's) ;)

CGTalk Moderation
03-21-2006, 06:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.