问题版本:v2.2.2 正常版本: v2.3.0
事情大概是这样的:
我想获取testS的世界坐标,脚本如下:
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property({type: cc.Node})
testNode: cc.Node = null;
start () {
let testSNode: cc.Node = this.testNode.getChildByName("testS");
/** testNode的世界坐标 */
let testWorld: cc.Vec2 = this.testNode.parent.convertToWorldSpaceAR(this.testNode.getPosition());
console.log("testWorld is ",testWorld);
/** testSNode所在的世界坐标 */
let worldTestS: cc.Vec2 = this.testNode.convertToWorldSpaceAR(testSNode.getPosition());
console.log("worldTestS is ",worldTestS);
}
}
设计分辨率为 960x640
testS节点的坐标为(10,10),test节点为(0,0)
接下来看输出:
后来我切换了版本为v2.3.0确认一下是不是creator的bug 结果…
