Orientable thrusters math. Trig/Vector math/CFrames

I am attempting to make a system of procedural thrusters, each thruster can only apply a force in two local axis lateral to the surface it is placed on. I have figured out how to make them activate properly in translational movements, but I can’t figure out how to do rotational movement. The hope for this system is to allow for proper activation of each thruster so that regardless of the orientation, the correct amount of each axis will be activated when the corresponding button is pressed.

This is my working translation script, and this code is run in every instance of the thruster.
(dont mind the bad implementation, just for testing)

	--working translation
	cf = attachment.WorldCFrame:ToObjectSpace(craft.CFrame)
	
	--translation is a Vector3 that corresponds to the desired axis to move on
	local v = cf:VectorToObjectSpace(translation)
	
	y.Force = Vector3.new(0, v.Y, 0) * thrusterForce
	z.Force = Vector3.new(0, 0, -v.Z) * thrusterForce

I have tried using a combination of CFrame transformations and dot products, along with vector tangents, but I have yet to get it to work entirely. I currently have the rotational movement in a semi working state, the input doesn’t match the same axis as the craft will rotate in, and one axis of rotation doesn’t work at all.

This is the layout of how I have each thruster, keep in mind that the Y and Z Vector forces can only apply force in their respective local axis, and each thruster is attached to a base ‘craft’ part.
image

Here is the full file, for those that would like to tinker and test a solution. I know it is possible, i just am not sure how.
thruster.rbxl (25.9 KB)

1 Like

Are you asking to give rotational velocity to a part, or are you asking for rotational transformation of a CFrame? Just making sure (:

Also, to be completely realistic if you are making a game about rockets, rockets require at least 2 thrusters to create rotational velocity, as 1 (pneumatic) thruster only allows movements from side to side.

No, vector forces on opposite sides with opposing directions to rotate a craft, so that if you were to change the position/orientation of thrusters, the handling of the craft would change, I am trying to make the system that determines what direction on what axis and by what amount given an input.

Well, technically the rockets would only require one for rotational, and two for translational, but given the design constraints of the thrusters, they can only thrust in two axis, meaning Y axis +/- value and Z axis +/- value. I just need to find an equation that will make the thrusters oppose each other properly as to rotate nicely around the center of mass.

And as my post said, it is supposed to be a procedural system,

I’d say something among these lines sound good.
thrust1X = input * -1 and thrust2X = input, which will have the thrusters oppose each other (in a single dimension) lineally with the input. This is only one dimension however, but still makes the thrusters X position oppose each other (supposedly).

The idea is to have it be more dynamic than that, so that a player could place the thrusters wherever they please, in any orientation, and the thrusters would behave in a manner that introduces controlability

Ahhh, I see. If there is no solution when I come back to my computer, I’ll take a look at this again, but at the moment, it is 3 AM so I should get some sleep. Best of luck!