-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Collider set_scale
does not work.
#452
Comments
Colliders are scaled by transform scale, so it's probably setting it back to Use transform scale for scaling the actual colliders used for physics entities. You can use |
That makes sense I suppose except then why is That said I'd rather have the ability to scale the collider independently because scaling transforms is usually a bad idea IMO. It can lead to shearing and stuff. So only scaling the collider would be nice. Whichever works though! Edit: oh wait I didn't read the full message, my bad. I see! I still think that scaling colliders independently seems nice. Alternatively, just adding a comment to set_scale that it'll be set for transforms also works. |
Yeah, I think it could be documented better. Or maybe even change it to a I think scaling physics entities with transforms is basically the standard in game engines. For example, if you were using Unity, Godot, or Unreal, you probably wouldn't set the scale in code, but instead just change the transform via the GUI. I'm pretty sure shearing does not cause issues in the case of scaling colliders. The scale is just a vector that scales the raw dimensions of a collider without doing any affine transformations or rotation. You should be able to notice this by rotating the child of a scaled entity and seeing that the visual mesh (with shear) doesn't match the collider (without shear). Haven't tested in rapier though! Shearing also only happens when a child entity of a scaled parent is rotated, which is probably quite rare. You can scale the collider independently of the mesh by making it a child entity and scaling just that. |
Setting the scale of a collider does not actually change its collider. Printing
Collider::raw
does show the collider being scaled correctly, but it's as if the actual physics and the debug render use the unscaled collider. To be clear, I'm testing collisions with a kinematic rigidbody (the example doesn't show this).Example:
Expected behavior: The scaled collider covers most of the screen.
Actual behavior: The scaled collider is tiny.
Manually updating the vertices to be scaled by 350.0 results in the correct output, but that is much less convenient than just using
set_scale()
.The text was updated successfully, but these errors were encountered: