Rigidbody

Rigidbodyに力を加える

void FixedUpdate()
{
  Vector3 force = new Vector3 (
    0.1f,
    0.2f,
    0.3f
  );
  transform.GetComponent<Rigidbody>().AddForce(
    force,
    ForceMode.VelocityChange
  );
}

Rigidbodyに回転の力を加える

AddTorque で回転の力を加えることができます。

void FixedUpdate()
{
  Vector3 force = new Vector3 (
    0.1f,
    0.2f,
    0.3f
  );
  transform.GetComponent<Rigidbody>().AddTorque(
    force,
    ForceMode.Force
  );
}

ForceModeについて

名前 概要
Force 質量を考慮して、継続的な力を加える
Acceleration 質量を無視して、継続的な加速度を加える
Impulse 質量を考慮して、瞬間的な力(インパルス)を加える
VelocityChange 質量を無視して、瞬間的な速度変化を与える