[LayaAir 1.0]transform的旋转和移动是异步方法吗?
在调用transform.rotate后修改锚点,旋转的锚点也改变了,是不是因为rotate是异步方法?如果是,有没有办法实现旋转之后回调?
var cube:MeshSprite3D;
// 省略了添加到场景中的代码
// 先移动锚点
cube.transform.pivot = new Vector3(
cube.transform.pivot.x + 0,
cube.transform.pivot.y - height/2,
cube.transform.pivot.z - width/2);
// 旋转
cube.transform.rotate(new Vector3(Math.PI/2*3,0,0));
var temp:Number = width;
width = height;
height = temp;
// 将锚点移回zho中心
cube.transform.pivot = new Vector3(
cube.transform.pivot.x + 0,
cube.transform.pivot.y + height/2,
cube.transform.pivot.z - width/2);
var cube:MeshSprite3D;
// 省略了添加到场景中的代码
// 先移动锚点
cube.transform.pivot = new Vector3(
cube.transform.pivot.x + 0,
cube.transform.pivot.y - height/2,
cube.transform.pivot.z - width/2);
// 旋转
cube.transform.rotate(new Vector3(Math.PI/2*3,0,0));
var temp:Number = width;
width = height;
height = temp;
// 将锚点移回zho中心
cube.transform.pivot = new Vector3(
cube.transform.pivot.x + 0,
cube.transform.pivot.y + height/2,
cube.transform.pivot.z - width/2);
没有找到相关结果
已邀请:
要回复问题请先登录
3 个回复
bpmf_d
赞同来自:
1561706430用户
赞同来自:
1571361226用户
赞同来自: