我是新来的团结,我寻找这个问题,但没有找到满意的答案。
我有立方体作为玩家,有刚体(重力解除激活)。
也很少有其他大立方体像建筑物和摄像机连接在玩家身上。
当我用箭头键移动玩家时,它会平稳地移动,但所有其他物体都会振动,因为我提高了玩家的地面和建筑物的速度,星星的振动越来越大。
我的玩家剧本:-
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;
}
}我怎样才能让金刚和其他物体平稳地移动??
发布于 2018-12-04 10:10:32
通过将物理设置b中的弹跳阈值b(编辑>项目设置>物理>弹跳-阈值)更改为8,可以避免玩家振动。
https://stackoverflow.com/questions/40734889
复制相似问题