-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
look_at() doesn't work with RigidBody3D #83412
Comments
Can you reproduce this in any of the 4.2 development builds? You can download them here. |
@Calinou It does work on dev 1 and 2. Doesn't work on all the next versions. Note: The reproduction project I uploaded has the player's "rod" facing Z-positive, while it should be Z-negative, hence the rod is pointing away from the green pillar (target). My mistake, made it in hurry. |
|
Thanks for the ping. This is kind of the dual of initial problem. First we were not updating |
I have one concern though. If the user modifies both |
I threw together a fix at #84799.
Modifying both the node transform and the physics server transform during the same |
From the doc:
If having a custom integrator is supposed to allow you to override position, I'm not sure why it shouldn't be possible to override the whole transform. At least from my understanding. |
I didn't mean to imply any sort of distinction between positions and transforms, if that's how it came across. Setting What I was referring to (and what I understood @Owl-A to mean) was more the act of modifying the node transform through properties like extends RigidBody3D
func _integrate_forces(state):
# Read/write to the node transform
transform.origin.x += 2.0 * state.step
# Read/write to the physics server transform
state.transform.origin.x += 10.0 * state.step Having either one of those will work just fine (as of #84799) but when you have both of them then the outcome of that script will (as of #84799) be that the body moves at 2 u/s, due to the node transform ending up overwriting the physics server transform. But as mentioned before, you can always call In either case, I struggle to see this being a common use-case. I suspect it's much more common to be dealing entirely with one transform or the other and not both. |
Godot version
4.2 beta 1
System information
Windows 11, Godot v4.2.beta1 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.3742) - Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 Threads)
Issue description
I have a top-down minigame where I use
look_at()
in_integrate_forces()
to rotate my RigidBody3D player character towards the mouse position. I noticed that in 4.2 beta 1 the code doesn't work. No errors, no warnings, the Vector3 I'm feeding it is just fine. The rest of the code works as expected. Did I miss something, or is it broken in the beta?Tried using it in 4.1.2 and it works just fine.
Steps to reproduce
Just make a plane mesh with collisions as a ground. Add a RigidBody3D to the scene, lock rotation on X and Z axes, add it a script. Add
_integrate_forces()
withlook_at(Vector3(0, position.y, 0))
inside. It should be rotating towards (0, position.y, 0) coordinates, but it doesn't. I suggest adding a front-facing rod mesh to visually see what's happening.Minimal reproduction project
42_beta_testing.zip
The text was updated successfully, but these errors were encountered: