[BULLET] Applying angle to impulse

I’m trying to launch a object with a angle using applyImpulse to a RigidBodyNode, something like a ball, the player have it’s angle (e.g. 32) and the launch impulse (e.g. 60), obviously there isn’t any angle argument in applyImpulse, so I need to “generate” that angle effect using Y and X, so panda will calculate the “angle”, something like that:

My trouble is to get the correct X argument, the available arguments are the character H and the object impulse (Y vector). Any help is welcome.

Not sure that understand correctly what you have and what you wish to get. Initially you say that have two angles: character and impulse, but then you say that you have angle for character and vector for impuls. And plz clarify we are talking about 2D or 3D?

Am I correct in understanding that you have an angle and power, and want to derive a vector (of length equal to the “power” value) from that?

(Your illustration makes things a little unclear: you at first indicate that the y-axis corresponds with “power”, but then go on to say that you want to derive a y-value…)

If I’m correct about what you want, then this should be a matter of trigonometry:
(This is a very brief overview–please ask if you’re unsure of anything.)
Take a look at the “Overview” section of the Wikipedia page on “Trigonometry”. Note that, for a right-angle triangle, there is a relationship between the right-angled sides, the hypotenuse, and the angle between the relevant right-angled side and hypotenuse. Now look at your coordinate axes: the axes are at right-angles to each other, and thus any line that starts from the origin and extends outwards (such as a vector) can be seen as a right-angled-triangle, with its x- and y- components giving the lengths of its right-angled sides.

Given the formulae given on the page to which I linked above, we can calculate the lengths of a vector’s components if we know the length of the vector and the angle that it forms with one of the axes (quite how the formulae are applied depends on which axis you measure you angle from–that is, whether, say, “ten degrees” means “ten degrees from vertical” or “ten degrees from horizontal”, and further, which way around your angles increase).

In short, cos and sin should do the job, using the relevant functions from that page. (For the moment, however, I’ll leave it to you to attempt to apply those formulae yourself. :wink:)