Game Development/Cocos2d

cocos2d 좌표계 변환 함수

유녕2 2016. 8. 17. 18:20

-  getChildByTag() : 메소드를 사용해서 태그로 부모에서 해당되는 자식의 객체를 리턴받을 수 있다.


Vec2 convertToNodeSpace(const Vec2& worldPoint) const;
- Converts a Vec2 to node (local) space coordinates. The result is in Points.

Vec2 convertToWorldSpace(const Vec2& nodePoint) const;
- Converts a Vec2 to world space coordinates. The result is in Points.

Vec2 convertToNodeSpaceAR(const Vec2& worldPoint) const;
- Converts a Vec2 to node (local) space coordinates. The result is in Points.

Vec2 convertToWorldSpaceAR(const Vec2& nodePoint) const;
- Converts a local Vec2 to world space coordinates.The result is in Points.

/== Same Method == / convertToNodeSpace(touch->getLocation())

Vec2 convertTouchToNodeSpace(Touch * touch) const;
- convenience methods which take a Touch instead of Vec2.
- return this->convertToNodeSpace(touch->getLocation());

Vec2 convertTouchToNodeSpaceAR(Touch * touch) const;
- converts a Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative).

로컬 로 터치 ( 월드 좌표 ) 좌표 로 변환합니다. 이 방법은 AR ( 앵커 상대 )입니다.



[출처] cocos2d-x 좌표 변환|작성자 농장주 상추