- Home /
mesh colliders problem
I have got a wall(gameObject) and a window (just hole in wall model). And I have got a nail. The wall and the nail have a rigidbody (isKinematic=true) and a collider (isTrigger=true).
I want to move my nail with script through the wall. How I can get OnTriggerEnter event (I have not got yet) ?
I can't use collider::convex equal to true for wall, because I don't want to have got OnTriggerEnter event when my nail goes through the window.
$$anonymous$$y script sets position of the nail in FixedUpdate function. When I mentioned collider I meant mesh collider.
Answer by Qwerty · Feb 03, 2011 at 02:18 AM
I'm not exactly sure what you were aiming for, but if i understood correctly maybe this could help?
just assign a tag to your wall (you could also do this vice versa and assign the tag to your nail.
function OnTriggerEnter(hit : Collider){
if(hit.gameObject.tag == "wall"){
//then do your nail transform through the wall here
}
}
alternatively you could have:
function OnTriggerEnter(hit : Collider){
if(hit.gameObject.tag == "window"){
//stop the nail
}
}
Hope this helps
Ok. The problem is that OnTriggerEnter hasn't been called. And I can understand why.
When I am setting convex to true for my wall OnTriggerEnter is being called, but I don't want that it would be called when the nail goes through my window.
Your answer
Follow this Question
Related Questions
Rigidbody bounce or character controller istrigger issues 0 Answers
OnTriggerEnter not recognising collision ?(Solved) 3 Answers
Trigger OnTriggerEnter Not Triggering Properly on Collision 0 Answers
Why isnt OnTriggerEnter Tags working. 1 Answer
How do i stop an asset from deleting the ground when it dies? 0 Answers