Raycast but ignore the collider of the gameobject it's being called from
c#, unity-game-engine
Solution
You can fire the ray cast using:
if(Physics.Raycast(ray, out hit, distance))
if(!hit.transform.name.equals("Player"))
// Do your stuff.
Make sure that the Player `GameObject` is actually named Player.
Problem
I want to send a raycast but not have it collide with my player. How can I do this? ``` using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Update() { Vector3 fwd = transform.TransformDirection(Vector3.forward); if (Physics.Raycast(transform.position, fwd, 10)) //hit something } } ```