#RigidBody3D only moving on a global axis with apply_force()

49 messages · Page 1 of 1 (latest)

hasty oak
#

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

split vapor
#

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.

hasty oak
#

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

split vapor
hasty oak
split vapor
#

No, the position of the node that the function is on, in this case the Ship.

hasty oak
#

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

split vapor
#

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.

hasty oak
#

But theres no positional offset

#

So how would it know these side thrusters should apply torque

#

Ship is, by the way, a parent

split vapor
#

I'm not sure what you're asking. Can you be clear: what is happening, and what are you expecting to happen.

hasty oak
#

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

hasty oak
#

I found the source code for apply force