この問題を検索しましたが、満足のいく答えが見つかりませんでした。
Rigidbody (重力非アクティブ化) が接続されたプレーヤーとして立方体があります
建物やプレーヤーに取り付けられたカメラなどの他のいくつかの大きな立方体。
矢印キーでプレイヤーを動かすと、プレイヤーはスムーズに動きますが、他のすべてのオブジェクトは振動します。プレイヤーの地面と建物の星の振動がますます速くなるにつれてです。
私のプレイヤースクリプト:-
using UnityEngine;
using System.Collections;
public class playerController : MonoBehaviour {
public Rigidbody player;
public float speed;
private Vector3 vect;
// Use this for initialization
void Start () {
player = GetComponent<Rigidbody> ();
}
void Update () {
float moveH = Input.GetAxis ("Horizontal");
float moveV = Input.GetAxis ("Vertical");
vect = new Vector3 (moveH,0.0f,moveV);
}
void FixedUpdate () {
player.velocity = vect*speed;
}
}
2] 私のカメラスクリプト:-
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour {
public Transform player;
public GameObject cameraa;
private Vector3 offset;
public float speed;
void Start () {
//calculating offset
offset = cameraa.transform.position - player.position;
}
// Update is called once per frame
void FixedUpdate () {
cameraa.transform.position = player.position + offset;
}
}
- カメラで Update()、FixedUpdate()、LateUpdate() を試しましたが、効果はほぼ同じで、スムーズではありませんでした。
どうすれば地面や他のオブジェクトをスムーズに動かすことができますか??