# how to calculate resulting velocity and angular velocity rocket has on center of mass

The issue i am having is that i can't seem to figure out how to apply force from a rocket to a bodies center of mass.

*Edit This is in 2D

e.g. Let's call the body 'ship'

the 'ship' is 1000 (relative unit) and the center of mass is normalized at [0,0] (origin)

the 'ship' has two rockets (lets say for thrust vectoring), one at [-2,-4] (left) and one at [2,-4] (right) relative to the center of mass, and that both had nozzles pointed down (90 degree angle counterclockwise from x)

if the left rocket were to fire at say 500 (relative unit), what formula could i use to find the resulting force and angular force on the center of mass?

if it helps, the language is a superset of javascript (custom preparser similar to typescript), and i'm using a custom physics engine that only accepts force on center of mass as an array e.g. [force x, force y, force angular]. I tried to recycle my collision detection algorithm but it was like jamming a square into a circle shaped hole.

I've searched since last night and can't seem to find a formula to do this (atleast not one I can understand, I can't understand complex math notations).

Any and all help is greatly appreciated.

TL;DR
I need a formula that gives the resulting force and angular force from a offset rocket on center of mass where the result looks like:

[force x , force y , force angular]

the center of mass is normalized to origin,

and takes the variables:
rocket offset ([x,y]),
rocket angle (in degrees to center of mass),
force of rocket (in relative units)

First we'll want to convert to world coordinates:

nozzleAngleWorld = nozzleAngleLocal + shipAngleWorld;
// Note here: nozzleAngleLocal is the angle your nozzle is *facing*/thrusting
// in your local coordinates, NOT the angle of the line from the center of mass through the nozzle.

forceWorld = new Vector2(
cos(nozzleAngleWorld) * rocketForce,
sin(nozzleAngleWorld) * rocketForce);


Then we can compute the worldspace offset of the point of force application from the center of mass of your ship. One way to do that is to store a "right" and "forward" unit vector for your ship's current orientation, but you can also do this with a matrix transform or trig.

rocketOffsetWorld = ship.right * (rocketOffsetLocal.x - shipCenterOfMassLocal.x)
+ ship.forward * (rocketOffsetLocal.y - shipCenterOfMassLocal.y);


The angular force on your ship is called a "torque", and it can be computed with a simple cross product:

torque = cross(rocketOffset, forceWorld);


Where the 2D version of the cross product gives us a scalar value:

function cross(a, b) {
return a.x * b.y - a.y * b.x;
}

• Thank you for the quick reply. trig was never my strong spot. My engine will accepts the torque value. So i understand properly, forceWorld would be the resulting force vector i apply to the body of the ship right? – Werlious Sep 1 '19 at 23:56
• btw i would upvote but my reputation from stack overflow doesnt carry over – Werlious Sep 1 '19 at 23:58
• Yes indeed. :) I'm assuming your engine prefers force/velocity vectors in world space, as most do, but we can correct it to another space if you need. And don't sweat the rep - I have more than I need! – DMGregory Sep 1 '19 at 23:58
• Much appreciated. Yes my engine prefers world space. the only time it uses local is for AABB and collision resolution. The project is a space rpg/rts aimed to be in pure js (node server handling the engine and client events, and some quick javascript to render to canvas). All the entities are made using an array of points, either defining a line or arc, and the physics is based on those points. Not sure if that's efficient but its a pet project :) Thanks for the info, its greatly appreciated :) – Werlious Sep 2 '19 at 0:05