- Home /
Falling object on collision
Hi there, I'm trying to get a leaf to fall when something hits it. I got it working with a cube but when trying to apply it to an interactive cloth it hasn't worked. I adapted the code to how I think it should be but it still isn't working! After tinkering for over an hour I've resorted to you :)
var theLeaf: GameObject;
function OnTriggerEnter (theCollide : Collider){ if(theCollide.gameObject.name == "leaf") { transform.GetComponent(Cloth).useGravity = true; } }
I've got a box collider on the cloth and object hitting it with 'Is Trigger?' selected. Any tidbits of information are most appreciated!
Your answer
![](https://koobas.hobune.stream/wayback/20220613080059im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Objects rotating after falling on another object with Physics & Gravity? 1 Answer
How to make a cloak for my character/Problems with colliders 0 Answers
add collider to cloth component in run time via script 1 Answer
Gravity and physics problem 1 Answer
Collision in between 2 objects moving away from each other? 1 Answer