-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Physics interpolation (3D): Issue when setting the position of a Rigidbody or Kinematicbody #59173
Comments
See the in progress docs: Specifically this section: This is expected 👍 and not a bug. This is one of the gotchas of using interpolation, you need to call To quote:
If you add the last line here, the effect is cured:
|
By the way, you can avoid the deferring and the yielding by setting the correct position from the start, like this:
The "difficult" part of this alternative is using local coordinates instead of global coordinates. In my opinion it's conceptually easier than deferring and yielding. Moreover, it ensures that the object in the physics server is created with the correct values on the first frame. @lawnjelly Why is the reset needed in this case as well (in 3.5 beta 2)? Edit: In this case I guess the transform is set correctly by the time the physics simulation starts, but even before that the transform is initialized to the identity, and only after |
It could either be some transform being set at the origin in the client code, or even just the previous transform in the physics interpolation code is unset on the first tick. So calling the |
Hm, I'm not sure if this is the right issue to append my problem to, but from my initial search it seems like it. I am unsure if it is a problem from my side but it seems that adding nodes to the tree in general seems to interpolate from their "original" translation. So:
would interpolate from Vector3.ZERO.
Is that correct? |
Yes, this is correct, adding a new object to the scene (in a location other than the origin) is one of the cases where a I think at some point I did consider automatically doing a In short any time you are instantaneously moving to a new location (teleport, often referred to), including adding to the scene tree you should call |
@lawnjelly there is no equivalent that I see for Godot 4.0 that is for calling |
Physics interpolation isn't implemented yet in 4.x. It's planned, but only after 4.2. |
Closing, cause lawnjelly answered #59173 (comment) For 4.x see #92391 |
Godot version
Godot 3.5 beta 2
System information
Ubuntu 21.10, GLES3
Issue description
When I instance a Rigidbody or Kinematicbody and immediately set the position right after, the object blinks for at least 1 frame before moving to the desired position.
This is not an issue when Physics Interpolation is disabled (Project Settings -> Physics -> Common).
Steps to reproduce
call_deferred("add_child", body)
oradd_child(body)
- doesn't matter.body.global_transform.origin = Vector3(5, 0, 0)
Minimal reproduction project
Run the game and left-click your mouse.
Godot-3.5.beta2.PhyInt.zip
The text was updated successfully, but these errors were encountered: