Checking if touching a trigger.

Hi there
It is quite simple to describe what i’m looking for,
but i couldn’t find a spezific answer for my problem.

Example:

if(//am i touching a trigger named "RightPlane"?//){
rigidbody.velocity.x+=2;
}

So what i have to type instead the of the comment to get this working?
If it isnt possible this way, show me another solution.
Help would be awesome, thanks for your attention =)

It would be

function OnTriggerEnter( collided : Collider ){

if( collided.transform.tag == "RightPlane" ){

rigidbody.velocity.x += 2;

}

}

There are some things you need to consider here first though. You might want to multiply a value by Time.deltaTime to get the addition of velocity frame independent.

Also, it is better to do physics things in FixedUpdate. An option here would be to set a bool to true in the TriggerEnter and then adding the velocity in FixedUpdate.

Also, it is usually bad to change the velocity directly. You should try using AddForce instead.

Some links: