【问题标题】:How do you know the velocity of rotation Dynamic Rigidbody and then independently rotated Kinematic Rigidbody with this velocity?你怎么知道旋转动态刚体的速度,然后以这个速度独立旋转运动刚体?
【发布时间】:2015-12-12 21:15:47
【问题描述】:

我能够朝正确的方向移动,但它旋转不正确(错误的方向)! 我在 Unity 5 中这样做:

Vector3 _veloMove;
Vector3 _rotation;

void Start()
{
 body = gameObject.GetComponent<Rigidbody>();
}

void OnCollisionExit() 
{
  _veloMove = body.velocity;
  _rotation = body.angularVelocity;
  isKinematic = true;
}

FixedUpdate()
{
    if (body.isKinematic)
    {
     body.MovePosition(transform.position + _veloMove * time;
     body.MoveRotation(transform.rotation * Quaternion.Euler(_rotation * Time.fixedDeltaTime));
    }
}

【问题讨论】:

    标签: unity3d game-physics


    【解决方案1】:

    看来这可能是您的问题:

    transform.rotation * Quaternion.Euler
    

    试着把它变成

    transform.rotation + Quaternion.Euler
    

    看看是否可行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 2023-03-22
      相关资源
      最近更新 更多