- Home /
Collision Issue
Hi there,
Im making a kinda Mirrors edge game,
I would like to perform a wallrun only when im in collision with my map.
My map is Tag:"Map"
I have read some tuto but nothing.
Here are my condition to perform a wallRun, I want to add if im colliding with "Map" if(canWallRun == true && characterController.isGrounded == false)// && characterController.collides... == "Map")
How can I make this action possible only when im colliding the map
THX
Answer by tnetennba · May 08, 2012 at 04:26 PM
I suspect that if your level is on big mesh then you will likely always be colliding with it.
However you can use these functions in a monobehaviour on your character:
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnCollisionEnter.html http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnCollisionExit.html http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnCollisionStay.html
This will give you a function call everytime you begin to collide, stay in a collision and exit a collision on that gameobject.
With the information you get from the Collision parameter in the funciton you can check that the game object you are colliding with is the "Map".
Hope that this helps you.
Your answer
Follow this Question
Related Questions
Tags returning true before collision 2 Answers
Is CompareTag faster than checking directly the GameObject? 1 Answer
Collision, tags, and triggers 1 Answer
What's wrong with OnCollisionEnter? 2 Answers