rigidbody
The rigidbody that was hit by the controller.
Read time 1 minuteLast updated 11 days ago
Definition
- Type: Property
- Namespace: UnityEngine
- Assembly: UnityEngine.PhysicsModule
public Rigidbody rigidbody { get; }
Remarks
Null if we didn't touch a rigidbody but a static collider.
Examples
using UnityEngine;public class Example : MonoBehaviour{ // Activate the gravity of other object we touch void OnControllerColliderHit(ControllerColliderHit hit) { if (hit != null) { hit.rigidbody.useGravity = true; } }}