Version: 2022.3
言語: 日本語
public Vector3 userAcceleration ;

説明

ユーザーが与える加速度を返します

この値の意味は (加速度計でも検出される) 重力の影響を ユーザーの動きから加速だけを残して除去されていることです。

using UnityEngine;

public class Example : MonoBehaviour { Vector3 forceVec; Rigidbody rb;

void Start() { rb = GetComponent<Rigidbody>(); }

void FixedUpdate() { // Apply forces to an object to match the side-to-side acceleration // the user is giving to the device. rb.AddForce(Input.gyro.userAcceleration.x * forceVec); } }