お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseRigidbodyの速度ベクトル
In most cases you should not modify the velocity directly, as this can result in unrealistic behaviour. Don't set the velocity of an object every physics step, this will lead to unrealistic physics simulation. A typical example where you would change the velocity is when jumping in a first person shooter, because you want an immediate change in velocity.
function FixedUpdate () { if (Input.GetButtonDown ("Jump")) { rigidbody.velocity = Vector3(0,10,0); } }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void FixedUpdate() { if (Input.GetButtonDown("Jump")) rigidbody.velocity = new Vector3(0, 10, 0); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def FixedUpdate() as void: if Input.GetButtonDown('Jump'): rigidbody.velocity = Vector3(0, 10, 0)