I just started playing around with 2D in Unity and I created a simple rocket that rotates in 360 degrees on the Z axis. I have made missle objects and have it setup so that that when they spawn they are pointing in the direction of the rocket. That part of things is all good. What I am not sure of is how to add force to the missle so that it shoots off in the direction it is facing. I have the AddForce code which takes a Vector2, but I really don’t know what sort of equation to put in the function so that the force ratio changes depending on the rotation. I suspect that there is some sort of mathematical formula needed for this.
For example if the rocket is pointing straight then I would want only force applied along the x axis and absolutely nothing in the y. If I were pointing straight up I would want the opposite with only a y axis force added.
I am sure this has been done before as it is a pretty common game mechanic. I just wanted to use a lifeline and ask the audience before I go about trying to come up with a mathematical formula on my own.
Thanks again everyone for your help. You guys rock. Excellent support community which really helps us noobs.