- Home /
A question about terrain collision
Hi again, another noob question from yours truly...
I am making a "Mode7" styled racing game... for the off-track area and boundary collision, I am using terrains (invisible to the player). The problem I have, is for the boundary terrain collision, if I set it to a trigger (to activate damage/play crash sound etc) the car drives through it... I know this is how triggers work, as it detects when one object intersects with another, so the workaround I have done is used two identical terrains, one as a trigger, the other to act as a solid object, to stop the car. Is this the way to go? Doubling up on terrains seems a bit overkill for me... I don't have any performance issues, the game runs perfectly on even older hardware (although I have yet to try out on iOS), but I would like to know if there is a better way, for optimisation's sake :)
Cheers!
You weren't getting OnCollisionEnter when it wasnt a trigger?
You should get an OnCollisionEnter I thought - hey I'm no expert with terrains and collision, but I can't see why you wouldn't.
Well you won't get an OnTriggerEnter if it isn't a trigger - but you will get an OnCollisionEnter (which takes a Collision as a parameter not a Collider).
Posted it as an answer so future generations won't need to read a lot of comments...
Answer by whydoidoit · Jun 15, 2012 at 12:41 AM
Use a single terrain, not a trigger and check OnCollisionEnter rather than OnTriggerEnter.
Works like a charm. Can't believe I was doing that! LOL. Noob...