ProwlEngine / ProwlEngine/Prowl
Removing/Disabling Rigidbody3D during runtime does not seem to work.
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 120
- Avg merge
- 11h 28m
- Merged PRs (30d)
- 11
Description
Describe the bug
Removing a Rigidbody3D or setting rigidbody.Enabled = false does not not appear to make a difference.
using System.Collections.Generic;
using Prowl.Runtime;
using Prowl.Runtime.Resources;
using Prowl.Echo;
[RequireComponent(typeof(Rigidbody3D))]
public class InventoryObject : MonoBehaviour
{
public Rigidbody3D? rigidbody;
public override void Start()
{
rigidbody = GetComponent<Rigidbody3D>();
}
public void EnablePhysics()
{
if (rigidbody is null) rigidbody = AddComponent<Rigidbody3D>();
}
public void DisablePhysics()
{
if (rigidbody is not null)
{
RemoveComponent<Rigidbody3D>(rigidbody);
rigidbody = null;
}
}
public void PickupObject()
{
InventoryStack.CollectItem(InventoryStack.ITEM_ROCK);
}
}
To Reproduce
Try removing Rigidbody3D component at runtime, the GameObject will continue to have physics.
Expected behavior
Physics stops.
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 by reproducing the issue with the InventoryObject example and runtime Rigidbody3D removal described in the issue. Trace the Rigidbody3D removal and physics lifecycle, then verify that removing or disabling the component stops the GameObject from continuing to participate in physics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100