Game Development Community

NonLinear movement

by James Petruzzi · in Torque Game Builder · 03/29/2005 (4:03 pm) · 6 replies

I was wondering how you would go about making a sprite move in a sine wave sort of motion instead of a straight line. thanks all..

#1
03/29/2005 (5:03 pm)
Well, maybe you could do a bunch of math (at which I stink) to calculate the movement or you could make your sprite move up and down in a loop while you move it along sideways.
#2
03/29/2005 (5:33 pm)
LinearVelocityPolar combined with (EDIT: lol I was half awake, angularVelocityPolar doesn't exist =/ for obvious reasons)angularVelocity + math can make some nifty combinations
#3
03/29/2005 (9:35 pm)
Also, you can try some creative mount hacking. Mount your sprite to an invisible object that is 100,0 in size, then just rotate it...that should isolate just one phase and give you a sine wave. Haven't tested it, but don't see why it shouldn't work. (T2D might not like zero sizes, if so just make it 100,1...)
#4
03/29/2005 (11:53 pm)
We've used the mount trick David mentions, just because we're lazy and its an easy way to produce the desired behavior. But yes, you could also do the math and work it that way.
#5
03/30/2005 (1:01 am)
IIRC there's some sine stuff in the space shooter demo (at least I think recall seeing comments to it in the code - been a little while since I've checked).
#6
03/30/2005 (10:19 am)
Thanks a lot guys I'll check it out!