Exemplo n.º 1
0
        private static U3DPhysxBox GeneratePhysxBoxCollider(int id, BoxCollider box_col)
        {
            U3DPhysxBox box = new U3DPhysxBox();

            box.id   = id;
            box.type = ColliderType.BOX;

            //world pos
            box.pos   = new Position();
            box.pos.x = box_col.transform.position.x;
            box.pos.y = box_col.transform.position.y;
            box.pos.z = box_col.transform.position.z;

            //scale
            box.x_extents = box_col.size.x * box_col.transform.localScale.x;
            box.y_extents = box_col.size.y * box_col.transform.localScale.y;
            box.z_extents = box_col.size.z * box_col.transform.localScale.z;

            //rotation, currently, not considered

            Debug.Log("BOX ID: " + box.id);
            Debug.Log("BOX position x: " + box.pos.x);
            Debug.Log("BOX position y: " + box.pos.y);
            Debug.Log("BOX position z: " + box.pos.z);

            return(box);
        }
Exemplo n.º 2
0
        private static U3DPhysxBox GeneratePhysxBoxCollider(int id, BoxCollider box_col)
        {
            U3DPhysxBox box = new U3DPhysxBox();

            box.id   = id;
            box.type = ColliderType.BOX;

            //world pos
            box.pos   = new killer.proto.Vector3();
            box.pos.x = box_col.transform.position.x;
            box.pos.y = box_col.transform.position.y;
            box.pos.z = box_col.transform.position.z;

            //scale, BUG:考虑父节点对子节点的缩放
            box.x_extents = box_col.size.x * box_col.transform.localScale.x;
            box.y_extents = box_col.size.y * box_col.transform.localScale.y;
            box.z_extents = box_col.size.z * box_col.transform.localScale.z;

            //rotation considered
            box.rotation   = new killer.proto.Vector4();
            box.rotation.x = box_col.transform.rotation.x;
            box.rotation.y = box_col.transform.rotation.y;
            box.rotation.z = box_col.transform.rotation.z;
            box.rotation.w = box_col.transform.rotation.w;

            Debug.Log("BOX ID: " + box.id);
            Debug.Log("BOX position x: " + box.pos.x);
            Debug.Log("BOX position y: " + box.pos.y);
            Debug.Log("BOX position z: " + box.pos.z);

            return(box);
        }