- Home /
How to detect intersection in meshes?
Hello, I'm making a game where you can instantiate 3d objects on the location of the mouse cursor. I need to know in runtime if a collider or a mesh of an object the script is attached to is "inside" another. This to prevent objects beeing instantiated in eachother. I can't use built-in collisions because they can (seemingly) only notice surface collisions with rigidbodies. OnTriggerEnter doesn't seem to work like I want either. Here's the javascript:
#pragma strict
var CInfo : Collision;
var ObjectToCollide : Collider;
function Start () {
}
function OnTriggerStay (ObjectToCollide) {
renderer.material.color = Color.red;
}
function OnTriggerExit (ObjectToCollide) {
renderer.material.color = Color.white;
}
What should I do?
Your answer
Follow this Question
Related Questions
How to add to a 3D object's length through code? 1 Answer
Overlap point of 2 kinematic colliders 1 Answer
How to add the right amount of points when my player destroys a gameobject? 0 Answers
Receiving information about getting hit by a Raycast 2 Answers
How do you execute Trigger-collider collision only in one gameobject? 1 Answer