View unanswered posts | View active topics It is currently Sat Apr 27, 2024 7:18 am



Reply to topic  [ 6 posts ] 
 Help with sine waves 
Author Message
User avatar

Joined: Sat Jan 31, 2009 11:34 pm
Posts: 88
Location: The U S of A's
Reply with quote
Post 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.


Sun Oct 25, 2009 6:08 am
Profile
User avatar

Joined: Tue Dec 12, 2006 3:10 pm
Posts: 495
Location: Uncertain quantum state
Reply with quote
Post 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.


Sun Oct 25, 2009 11:07 am
Profile
User avatar

Joined: Mon Jun 22, 2009 3:57 pm
Posts: 1020
Reply with quote
Post 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.


Sun Oct 25, 2009 11:40 am
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post 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...


Sun Oct 25, 2009 1:23 pm
Profile
User avatar

Joined: Sat Jan 31, 2009 11:34 pm
Posts: 88
Location: The U S of A's
Reply with quote
Post 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.


Sun Oct 25, 2009 3:41 pm
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post 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.


Attachments:
SineGun_v2.zip [4.58 KiB]
Downloaded 206 times
Sun Oct 25, 2009 6:27 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.197s | 14 Queries | GZIP : Off ]