- Home /
I need the ability to disable the functionality of a Rigidbody without deactivating it's GameObject, removing it, or changing any of it's physics settings
Hi, I spent a couple hours browsing the forum looking for answers to this question and didn't find any so here's my problem. I'm in the middle of programming a system for picking up and moving groups of GameObjects
containing Rigidbodies
. The goal is to have the player create machines using various objects and then group them together and move them around with a laser pointer type tool. Allowing the player to create various different machines and then chain them together.
The problem I'm having is that I need to maintain all the settings that each Rigidbody
contains along with it's Transform
. There are all kinds of objects some of which are kinematic objects, objects with axis/rotation constraints, & objects that ignore collision detection. This all means I can't change Rigidbody.isKinematic
, Rigidbody.detectCollisions
, Rigidbody.constraints
, or remove the Rigidbody and add it back again to disable the object. If I did, it could remove some Rigidbody
settings that some of the objects contain. I'd like to avoid having to store all the removed components and have to create a way of figuring out which belongs to which, as there are going to be a lot of objects.
What I really need is a way to disable all Rigidbody
functionality without removing the component, or changing any of it's physics settings. It would be awesome if Rigidbody
had a simple .enabled
bool like MeshRenderers
or other components.
Any suggestions would be very helpful. The only other option I can think of is cloning every single object in the list, removing the Rigidbody
from the orignals during the movement of the group, and then destroying them and replacing them with the copies. This however is less than ideal and potentially very expensive depending on the number of objects.
Any help is appreciated, thanks!
Your answer
Follow this Question
Related Questions
Throwing a Spear 1 Answer
Vibrating GameObjects 0 Answers
Why can't my enemies walk up an incline? 1 Answer