ColliderShape.Offset setter does nothing
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
Release Type: Official Release
Version: 4.1.0.1948
Platform(s): only tested Windows, might be on other platforms
Describe the bug
When changing the offset of a ColliderShape at runtime via code, nothing happens. When debugging in visual studio, the ColliderShape has the new values in it, but looking at the actual game, collisions only happen where the ColliderShape was before and the DebugPhysicsShapeComponent shows the collider at the exact same position as before. Setting the offset in the Editor works fine tho.
To Reproduce
Steps to reproduce the behavior:
- Create Entity with Rigidbody and ColliderShape
- a) Change the offset of the ColliderShape with code
OR
b) Even a complete new instance of a colliderShape assigned to the RigidBody won't have an offset.
OR
c) Even a complete new instance of a rigidbody with the new shape won't have an offset.
Expected behavior
The ColliderShape should be at a new position.
Code used:
var box = new BoxColliderShape(true, Vector3.One);
box.LocalOffset = Vector3.UnitX * 10;
box.UpdateLocalTransformations();
rigidBody.ColliderShape = box;
rigidBody.UpdatePhysicsTransformation();
I tried this with various different combinations of box.UpdateLocalTransformations() and rigidBody.UpdatePhysicsTransformation(). Also see different approached in to reproduce: 2.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ColliderShape and RigidbodyComponent, focusing on LocalOffset, UpdateLocalTransformations, ColliderShape assignment, and UpdatePhysicsTransformation; use DebugPhysicsShapeComponent to observe the result. Reproduce the runtime offset change from the issue and confirm that collision detection and the debug shape move to the new position.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100