`第一步
取得终点目标的节点。目标节点自己的位置转换成世界坐标,然后return 世界坐标信息
/**`
- 获取自己的世界坐标
*/
getselfWorldPosition: function () {
// console.log('节点位置',this.node.getPosition())
let position_m = this.node.convertToWorldSpaceAR(this.node.getPosition());
console.log('节点世界坐标',position_m)
return position_m
}
`/**
* 需要移动到的世界坐标转换成相对坐标
*/
toWorldPosition: function () {
let self = this
let m_home = this.home.getComponent(Money) // 拿到金币显示的节点信息
// m_home.getselfWorldPosition() 获取金币框世界坐标 ,convertToNodeSpaceAR 世界坐标转换成相对金币节点的坐标
let to = this.node.convertToNodeSpaceAR(m_home.getselfWorldPosition())
console.log('转换',to)
}
这样获取的坐标,然后节点2移动,位置不正确有便宜,如何获取完全正确能重合在一起的坐标?拜谢
