Transform 位置 旋转

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Transform 位置 旋转相关的知识,希望对你有一定的参考价值。

using UnityEngine;
using System.Collections;
using Box2D.Dynamics;

public class BodyGameObj : MonoBehaviour {
    public b2Body body;

    void Start () {
    
    }

    void Update () {
        Vector3 pos = transform.localPosition;
        pos.x = body.GetPosition ().x;
        pos.y = body.GetPosition ().y;
        transform.localPosition = pos;
        transform.localRotation = Quaternion.Euler(0, 0, body.GetAngle () * 57.3f);
    }
}

 

以上是关于Transform 位置 旋转的主要内容,如果未能解决你的问题,请参考以下文章