Skip to content
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

Editor component UX: adding a RigidBodyPhysics to an Object sends it falling up or down at edit time #1032

Open
metaleap opened this issue Jan 18, 2025 · 2 comments

Comments

@metaleap
Copy link
Contributor

metaleap commented Jan 18, 2025

Demo vid below — to repro, open Content/character_controller/assets/level.wiscene and find and select the Cube_Cube.001 with scale 1.46 (or any other, really).

  1. Set the Y position to 0, add a RigidBodyPhysics component. The cube jumps up to Y=1.42542.
  2. Remove it, reset Y position, then carefully move the cube minimally downwards, just until its debug-AABB's bottom coords are just below the ground. Now add a RigidBodyPhysics and the cube falls to bottom infinity.

The issue: since a new RigidBodyPhysics defaults to "Start deactivated", this sudden movement autonomous activity of currently-being-authored in-world objects is at a minimum in contradiction to that default setting. Furthermore, it is questionable whether this simulation should be played out at edit time (not run time) automatically at all. Maybe only on a button click might be less surprising, because it is a handy capability to have on demand — just not automatically & instantly, IMHO =)

rec-2025-01-18_19.58.53.mp4
@turanszkij
Copy link
Owner

This is not an error, but because the cube is centered at the bottom, and the rigidbody gets created as a cube by default at the bottom, it will offset the graphics mesh. You can apply local offset to solve this, in the rigidbody settings. You should turn on physics visualizer in the general options to see why this happens. You can also disable physics simulation in the editor with the little physics button under the big + button. You can also offset the cube mesh itself to be in its center instead inside the MeshComponent settings -> Recenter button.

@turanszkij
Copy link
Owner

The difference between centered to bottom and normally centered cube mesh with physics visualizer enabled:
centered to bottom:

Image

centered to center:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants