- Home /
Duplicate Question
http://answers.unity3d.com/questions/536949/how-to-make-a-collider-trigging-and-go-though.html
How to make a rigid body ignore collider
How do i make a rigid body ignore a collider but still trigger it so the code goes off.
Answer by Lukamyte · Sep 15, 2013 at 12:50 AM
Have you tried setting the rigidbody's collider to being a trigger?
function OnTriggerEnter(other : Collider){
Triggered = true;
}
This should do the trick. You only need to set up the variable.
Edit--
You need to set up a tag for the object. Go to "tags" on the desired object and set the tag to one of your choice. There should also be the option of adding new tags.
From there use this edited version of the script above.
function OnTriggerEnter(other : Collider){
if(other.tag == "tag"){
Triggered = true;
}
}
Well i made some progress. I can get it to pass through the collider but not trigger. Where do you set it on the rigidedBody to trigger?
Also here is the script i have so far.
function OnTriggerEnter (other : Collider)
{
if(other.gameObject.name == "Center Road Collider")
{
inputSteer = .3;
print("Im hitting the center");
yield WaitForSeconds(1);
inputSteer = -.3;
yield WaitForSeconds(1);
inputSteer = 0;
}
if(other.gameObject.name == "Big Turn Begin")
{
print("hello");
var cornerScript = GameObject.Find("Corner").GetComponent(CornerSteerAngle);
inputSteer = cornerScript.wideSteerAngle;
}
}
Follow this Question
Related Questions
Player Rotation with the mouse 1 Answer
UnityEngine.GameObject Error 1 Answer
Can I ignore coliisons between a rigidbody and a collider? 1 Answer
AddTorque Isn't Working? 1 Answer
Pounce/ Launch player 1 Answer