- Home /
Can I stop my player from coming to a stop when colliding?
Sorry if my question is a bit strange, but basically I want the player to be able to roll into objects and the object is destroyed.
Now, I have a script that does this, but my problem is, when the player collides, they come to a stop and bounce back form the object. Is there a way the player can roll into objects and go right through them whilst destroying them?
This is the script I have:
function OnCollisionEnter ( collision : Collision) { if (collision.gameObject.name == "House Prefab") Destroy (collision.gameObject);
if (collision.gameObject.name == "PalmTree") Destroy (collision.gameObject);
if (collision.gameObject.name == "Pinetree1") Destroy (collision.gameObject);
}
Answer by Carl 2 · May 05, 2011 at 05:05 PM
Never mind, I just figured it out by adding rigid bodies to the objects, sorry folks lol
Glad you solved the problem, but I would also recommend using the colliders as triggers if you don't want them to have a physical effect.
Answer by Meltdown · May 05, 2011 at 06:05 PM
If you don't want your player to be affected by forces, i.e such as colliding with your PalmTree, you can set it to isKinematic = false on the Rigidbody component on your player.
Your answer
![](https://koobas.hobune.stream/wayback/20220613131957im_/https://answers.unity.com/themes/thub/images/avi.jpg)