# How to rotate rocket using thrusters

cyan cube shows direction I want rocket to rotate
how to make code that selects thrusters that will move rocket in shown direction

This is off the top of my head- Get the direction from the rocket to the cube. Then get the direction from the rocket center to each thruster. Normalize those thruster directions and get their Vector3.Dot product with the direction you want to travel. Activate the two thrusters that give negative dot-products and activate them in proportion to the absolute value of the dots. What I think I just said is find the two thrusters that are pointing away from the cube (those with negative dot products). Those dot products are the cosine’s of the angles and should be between 1 and -1. The - values point away from the cube, so activating them pushes toward the cube. One that is at -1 is 180 degrees from the cube, and activating it will move directly toward the cube. If neither are directly away, then activate both in proportion to the dot’s you get. You’ll have to play with that last step a bit to get it how you want it, but it should get you started in the right direction (pun intended).