|
hello I was wondering if I can change the physics material of an object's colider. for example, changing it from metal to bouncy. is it even possible?
(comments are locked)
|
|
You can pre-create the desired material in the editor Unity or use available in "Assets/Standard Assets/Physic Materials". Then place it into "Assets/Resources/PhysicMaterials". And for runtime change:
Use the following code to assign when you import resources: This doesn't seem to work for me. I keep getting an error message saying the editor is expecting a semicolon on line 78, which ends up being in between the E and the S in the word Resources. Anyone have any ideas?
Dec 08 '11 at 07:54 AM
Cnotey
(comments are locked)
|
|
Yes, you can change
or changing individual properties (
(comments are locked)
|
|
Be careful if you decide to change the properties of a PhysicMaterial object at runtime instead of/without changing the sharedMaterial (or material) property of the colliders using it. In some cases, the physics engine will continue to use the old properties of a PhysicMaterial object. See this forum post of mine for more information.
(comments are locked)
|
|
Yes, that is possible. You can set the active Make a public array of PhysicMaterials in the class
If you fill this list from the inspector in the Unity editor, you can then assign one of the materials at runtime:
(comments are locked)
|
