Data Realms Fan Forums http://forums.datarealms.com/ |
|
Help with sine waves http://forums.datarealms.com/viewtopic.php?f=73&t=16948 |
Page 1 of 1 |
Author: | Cooljoesmith [ Sun Oct 25, 2009 6:08 am ] |
Post subject: | Help with sine waves |
I want to make a projectile move along a path using sine. But to tell the truth, I am really not sure how to do this. I would imagine using the velocity with the sine function and all that. Essentially i want to have a projectile move along a wavy path(sine). It has to work regardless what angle the projectile is fired.(fancy looking projectile yay) any help will be wonderful. thank you. |
Author: | findude [ Sun Oct 25, 2009 11:07 am ] |
Post subject: | Re: Help with sine waves |
Unfortunately I can't give you the complex 50 line math blah, but I can suggest using a timer, sine function on it, and self.Vel.Perpendicular. |
Author: | Barnox [ Sun Oct 25, 2009 11:40 am ] |
Post subject: | Re: Help with sine waves |
Shook's Pack O' Mods has a Sine wave gun. But it only shoots horizontally. Aiming higher/lower changes the speed. You could try looking at the code for that, and cannibalising it? I'd upload the .lua file, but I'm not sure what the rules are on posting other people's code. |
Author: | Duh102 [ Sun Oct 25, 2009 1:23 pm ] |
Post subject: | Re: Help with sine waves |
To make a true sine wave in all directions, you'd have to have the projectile figure out what direction it was aimed at and instead of linking the X or Y coordinate to the sine function, link the sine function to some scalar perpendicular to the particle's motion vector. I'm not that great with math, but it should be doable if you have a good knowledge of trig and coordinate math... |
Author: | Cooljoesmith [ Sun Oct 25, 2009 3:41 pm ] |
Post subject: | Re: Help with sine waves |
ok, i'll look as the pack'o mods and see if i can use the sine gun to my needs. |
Author: | Abdul Alhazred [ Sun Oct 25, 2009 6:27 pm ] | ||
Post subject: | Re: Help with sine waves | ||
Free to use for anyone. Edit: The code I wrote is complicated in a stupid way so I have attached a better version that also fire two bullets in a mirrored pattern.
|
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |