Yea, I know this is more math than necessarily corona related, but, I need some help. I have a cannon barrel that rotates and I want to fire cannonballs out of it based on the angle of the cannon.
When the cannon is at a rotation of 0(pointing straight up) I can simply call cannoball:setLinearVelocity(0,-200) and the cannon ball fires upward at a decent pace. However, what if my cannon is rotated 45 degrees? I want the spawn point to be the same place, but I obviously need the proper X and Y values for setLinearVelocity(x,y) that still maintains the same 200 move speed but proportioned properly. What are the trig functions I need(and maybe a little sample)?
Thanks guys! [import]uid: 75335 topic_id: 12577 reply_id: 312577[/import]
[import]uid: 75335 topic_id: 12577 reply_id: 45987[/import]
[import]uid: 82408 topic_id: 12577 reply_id: 56970[/import]