#RigidBody3D only moving on a global axis with apply_force()
49 messages · Page 1 of 1 (latest)
In the first video I use -basis.z, in the second video I use -global_basis.z
The yellow box is the ships position + -basis.z * 16
Same for the blue box except it uses -global_basis.z
This is the desired outcome
But instead the thruster that moves forward, moves north
And the side thrusters move west and east
Etc
(The side thrusters should also move the ship slightly but mostly turn it)
Here is my thruster code
I got it working
after days of trying
but it doesnt make any sense to me
i used vector3.ZERO instead of position
technically, this is solved but i'd like someone to give an explanation
The docs have the following to say on the matter: position is the offset from the body origin in global coordinates. In other words, the final parameter already starts at your node's position, passing the current position would result in the force being applied from somewhere way off to the side, rather than centered on the ship.
But where does it get the nodes position? Apply force is called in the ship node
From my understanding, a basis only provides rotation and scale
Unless apply force somehow gets the node that called the method
@midnight canopy Figured I should @ you here as we were both stuck on this
It gets the position of the node it "belongs to" as it were. So it will be force centered on the ship, even though it's being called from the thruster.
Do you mean the function gets the position of the node that calls it?
No, the position of the node that the function is on, in this case the Ship.
This is all strange to me, I'd expect it work like apply central force but it does apply torque
I have no clue how from the information given it would calculate torque
The docs state on apply central force "This is equivalent to using apply_force at the body's center of mass."
It has all the information it would need to calculate torque - it knows how much force, in what direction, and where on the object the force is pushing.
The first two both being contained by the force vector, and the second in the positional offset vector.
But theres no positional offset
So how would it know these side thrusters should apply torque
Ship is, by the way, a parent
I'm not sure what you're asking. Can you be clear: what is happening, and what are you expecting to happen.
In my mind, apply force with a position of 0,0,0 should work exactly like apply central force
Because 0,0,0 means no offset from center
Apply central force cannot apply torque
Because torque would need the force to be positioned away from the ship on atleast 2 axes
But my side thrusters do
What Im about confused is
How does it know from the info in that function that the thruster is offset in a way that creates torque
To be clear it is intentional that the side thrusters do that
And the forward and backward thrusters do go forward and backward like intended
Everything works
But i dont see where the thrusters offset is passed to the ship’s apply force function
The thrusters are children of the ship btw