0 votes

Dear all, recently I'm using Godot to create a ball game. To simplify the question, assuming in the physics world there's only one RigidBody called ball, a Camera which can be rotated around with ball.

Now I wanna give the ball a torque by using apply_torque_impulse method, for example this torque value is Vector3(0, 10, 0) which means (for now) rotate the ball along Z axis.

Then, I rotate the Camera around the ball for 90 degrees for example (the UP is Y axis always), and here the problem comes:
Before the camera move, the impulse value Vector3(0, 10, 0) will let it rotate backwards (Z axis), but after moving, the same value cannot be used anymore, because the current correct axis should be X axis as I still want it to roll backwards!

So my question is how to convert/transform that value to the correct one as Camera moves to different angle degrees.

Thanks a lot.

Godot version 3.5.1
in Engine by (14 points)
edited by

1 Answer

0 votes

Forces are applied based on the 3D world global coordinates. after you move your camera, if you apply the same force Vector3(0, 10, 0), it's normal the ball rotates the same way (for the 3d world)
you only see it roll backward because your camera "point" of view changed.

The 3D world does NOT move with your camera.

you should use node transform.basis.x, y and z if you want to control position and direction, not Vector.

I suggest you to read this : Using 3D transforms

by (68 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.