23-06-2020, 10:31 AM
(This post was last modified: 23-06-2020, 10:38 AM by caldorf.
Edit Reason: minor typos fixed. content is the same
)
Just purchased and am really impressed with Obi Cloth overall.
I am using it to build a run time level editor in Unity.
I have a prefab for a character that is lying down with a blanket on top. The blanket is an ObiCloth. The configuration of the cloth was copy and pasted from the ClothStaticMeshCollider sample scene.
My prefab works when I drag and drop the prefab from the "Project" window in the IDE at both build and run time. The cloth properly collides with the colliders, etc... Looks great.
However, when I try to instantiate the same exact prefab from a script, the cloth passes directly through the colliders, and drops through the ground and into the bottomless abyss.
This script is triggered at runtime when I point and click where I want the object with the cloth applied to it to appear.
I instantiate the prefab with something like the below snippet:
The prefab is made up of (1) my character model, (2) a bunch of capsule colliders w/ ObiColliders for the character, (3) a plane with another collider w/ ObiCollider, and (4) the Obi cloth.
When I inspect the instantiated prefab all the components and hierarchy are the same when it's instantiated via script or IDE.
I've tried programmatically adding the solver, and changing the phases for the colliders. In both cases I found a way to make it work when I drag at drop the prefab from the Project window in the IDE into my scene. However, I've still not managed to get the obicloth blanket to work when the prefab is instantiated at run-time via script.
Before I dive any deeper I thought I'd check in to see if there is a known fix for this issue.
Any ideas on how to get my prefab to work when programmatically instantiated?
Thank you for your help!
I am using it to build a run time level editor in Unity.
I have a prefab for a character that is lying down with a blanket on top. The blanket is an ObiCloth. The configuration of the cloth was copy and pasted from the ClothStaticMeshCollider sample scene.
My prefab works when I drag and drop the prefab from the "Project" window in the IDE at both build and run time. The cloth properly collides with the colliders, etc... Looks great.
However, when I try to instantiate the same exact prefab from a script, the cloth passes directly through the colliders, and drops through the ground and into the bottomless abyss.
This script is triggered at runtime when I point and click where I want the object with the cloth applied to it to appear.
I instantiate the prefab with something like the below snippet:
Code:
// NOTE:
// "type" is set at build time in the inspector
// to the same prefab that works when I drag and drop it into a scene
Public GameObject type;
GameObject w = Instantiate(type);
The prefab is made up of (1) my character model, (2) a bunch of capsule colliders w/ ObiColliders for the character, (3) a plane with another collider w/ ObiCollider, and (4) the Obi cloth.
When I inspect the instantiated prefab all the components and hierarchy are the same when it's instantiated via script or IDE.
I've tried programmatically adding the solver, and changing the phases for the colliders. In both cases I found a way to make it work when I drag at drop the prefab from the Project window in the IDE into my scene. However, I've still not managed to get the obicloth blanket to work when the prefab is instantiated at run-time via script.
Before I dive any deeper I thought I'd check in to see if there is a known fix for this issue.
Any ideas on how to get my prefab to work when programmatically instantiated?
Thank you for your help!