ControllerColliderHit.gameObject

public GameObject gameObject;

Description

The game object that was hit by the controller.

using UnityEngine;

public class Example : MonoBehaviour { void OnControllerColliderHit(ControllerColliderHit hit) { // Objects we touch, move them to position (0, 0, 0) hit.gameObject.transform.position = Vector3.zero; } }

Did you find this page useful? Please give it a rating: