18-02-2022, 08:52 AM
(This post was last modified: 18-02-2022, 08:56 AM by josemendez.)
(18-02-2022, 12:14 AM)Freebird17 Wrote: Hello,
Sorry if this question has been asked elsewhere, I tried looking but found nothing. Basically, do collision materials override? What I mean is, let's say I set my emitter to have a specific material (ie, ice), but another object with a collider to a different material (ie, high friction). Will the fluid react to every other collider as 'ice,' but react to the specified object as 'high friction'? Or will it choose the emitter material instead?
Collision materials behave exactly like physics materials in Unity (and pretty much all physics engines): when two objects with different collision materials collide, the collision values used for friction, adhesion, etc are calculated according to the "combine" settings of the materials.
See:
http://obi.virtualmethodstudio.com/manua...rials.html
https://docs.unity3d.com/Manual/class-Ph...erial.html
For instance, in a collision involving a material with zero friction and a material with 0.8 friction that have "friction combine" set to average, the resulting friction is (0 + 0.8)/2 = 0.4. If the materials have different combine settings, they're used in order of preference (lowest enum index first).
(18-02-2022, 12:14 AM)Freebird17 Wrote: The reason I ask is that I have a character whose colliders are created with a script in-game, so I have another script to add the ObiCollider component after that to get around the ObiCollider requirement. When I try to add a material to the recently created colliders, it says that the material property is inaccessible (I assume its a private variable and I don't just want to start messing with the code at will). I would like to set the materials for this character's colliders to be different than other objects in the game, and I don't really know the best way to go about this.
Thanks in advance!
ObiCollider.CollisionMaterial is a public property, you might have been trying to access its private backing field. You should be able to set it in a script, see the API docs for details:
http://obi.virtualmethodstudio.com/api.html
cheers!