Hello im trying to create a building mechanism to my game. The building mechanism is done and works fine. But i’ve got an problem when i try to place the “building”. I have islands that have meshcolliders and a script attached to a cube thats trying to detect if the cube is colliding with a collider that is called “islands”. My mesh collider is named islands and has a non convex meshcollider on it. but the cube is not detecting it. Any idea why?
Here is the script that has the problem:
var buildControllerScript : BuildController;
function Start ()
{
buildControllerScript = GameObject.Find("Main Camera").GetComponent(BuildController);
}
function OnCollisionStay (col : Collision)
{
if(col.gameObject.name == "islands")
{
buildControllerScript.canPlace = true;
}
}
function OnCollisionExit (col : Collision)
{
if(col.gameObject.name == "islands")
{
buildControllerScript.canPlace = false;
}
}