Quantcast
Channel: Latest Questions by Enigmaticall
Viewing all articles
Browse latest Browse all 4

Making a bullet path travel in a sine wave

$
0
0
I am currently making a flamethrower weapon for my 2D topdown shooter, and the purpose is for the bullets to be shot at a very fast rate. I am unhappy with how uniform it becomes though, so I would love to implement a slight sinusoidal curve into the bullet path. I have attached a photo of the current straight path, as well as the code which implements that, and I am just trying now to figure out how to implement mathf.sin() into my code. ![alt text][1] [1]: /storage/temp/28846-capture2.png function ShootFlamethrower () { var bulletClone : Rigidbody2D = Instantiate(bulletFlamethrower, transform.position, transform.rotation); bulletClone.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward); bulletClone.AddForce(bulletClone.transform.right * bulletSpeed); } I am very new to game programming, so I really appreciate any and all help. Thank you kindly!

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles



Latest Images