- Home /
collision with terrain problem?
i have a side scroller shooter game, old style . the player is a airplane , it has multiple colliders on it , to make impacts more correct .
the terrain has a collider on it . if i physics on the terrain and so it isKenetic = false and have no constraints the the airplane will detect when it hits the ground, but the ground will move because of the impact . if i do isKetentic = true OR have any constraints on the terrain then the airpllane will not detect when it hit the terrain .
please help
Answer by Daryn · Aug 16, 2012 at 07:48 PM
this is for C# but I would do
void OnCollisionExit () {
rigidbody.isKinematic=true;
}
This will cause it to lock in place when it goes to move. I hope this works I really dont know why your game dont work though.There is way to many problems with Unity.
Unity is fine. You wouldn't say "there are too many problems with pianos" just because you didn't know how to play.
But i would say it had problems if the keys were broken or it needed to be tuned. I know what i am doing and it doesnt always work
Judging by your question and answer history I think you should reevaluate your confidence in the statement "I know what i am doing". Sure, there are bugs in Unity, but I am not sure know what you are talking about.
Answer by flaviusxvii · Aug 16, 2012 at 04:46 PM
You probably don't want Rigidbodys at all. Just use colliders and change the direction of the plane (or destroy it) when you hit the ground.
Answer by mikebelotti · Aug 16, 2012 at 08:21 PM
To stop something from moving upon impact, you should be able to modify its rigidbody constraints. In the inspector, set it to lock its X, Y and Z positions so that the physics engine won't move it. (Or, in code, do something like `rigidbody.constraints = RigidbodyConstraints.FreezePosition`.)