Version: 2021.3
言語: 日本語
public bool useGravity ;

説明

Rigidbody が重力の影響を受けるかどうか

これを false に設定すると、リジッドボディは無重力空間にいるかのように振る舞います。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Collider coll;

void Start() { coll = GetComponent<Collider>(); coll.isTrigger = true; }

// Disables gravity on all rigidbodies entering this collider. void OnTriggerEnter(Collider other) { if (other.attachedRigidbody) other.attachedRigidbody.useGravity = false; } }