using UnityEngine;
using System.Collections;
public class Accelerometer : MonoBehaviour {
public Vector3 positionplayer;
// Update is called once per frame
void Update()
{
transform.Translate(Input.acceleration.x, 0, -Input.acceleration.z);
transform.Rotate (0,0,0);
}
}
私はプレイヤーにこのスクリプトを添付した移動作る方法を、バウンスを開始し、壁に当たったとき、すべてのものが正常に動作しているが、それは障害物に当たったとき、それはdoesnのbouncing..butそれが開始されます「T iは平面を用いて粉砕を行ったプレイヤについてキューブプレイヤーが、それはプレイヤーが正常に
を使用して、4つの壁は衝突、剛体を添加し、質量と重力剛体設定されている(壁がヒットされた場合のみ)地面に
バウンス1
壁には、ボックスコライダーとjが追加されていますUSTは剛体
using UnityEngine;
using System.Collections;
public class Accelerometer : MonoBehaviour {
public Vector3 positionplayer;
Rigidbody b;
public float speed = 10.0f;
private Quaternion localRotation;
// Use this for initialization
void Start() {
localRotation = transform.rotation;
}
// Update is called once per frame
void Update()
{
float curSpeed = Time.deltaTime * speed;
//transform.Translate(Input.acceleration.x, 0, -Input.acceleration.z);
transform.position += (transform.right * Input.acceleration.x) * curSpeed;
transform.position += (transform.forward * -Input.acceleration.z) * curSpeed;
//transform.Rotate (Input.acceleration.x,0,0);
localRotation.z += -Input.acceleration.z * curSpeed;
localRotation.z += Input.acceleration.z * curSpeed;
//transform.rotation = localRotation;
print (transform.position);
}
}
これはあなたの状況に関連するが、あなたはしたくない場合は、あなたのあなたがそれらのように、剛体の設定を確認する必要があります回転させるように変換しない場合があります値は変更されません。それはx/y/z座標でそれを分けるので、あなたはそれを特定することができます。 –