With the new render system preparing for 3D games in future (i think so), the node.position now return cc.v3 object instead of cc.v2 and my troubles come from here.
Let’s say that i’ve 2 nodes and i’d like to calculate distance between them to make motion effect (Ex: earned coin move from enemy to UI), and these 2 nodes stay in different containers () and i do as below:
- Convert enemy position from its container to coin’s container by convertToNodeSpaceAR function and this return cc.v2 same as older cocos version. (called enemyPos)
- Get coin’s position by call node.position and this return cc.v3 object instead of cc.v2 object as older cocos version. (called coinPos)
- Now calling coinPos.sub(enemyPos).mag() return NaN value and things go wrong!!!
I can handle this trouble by doing a simple convert cc.v2<=>cc.v3 but it’s not sense and so so conflict. Where return cc.v2? Where return cc.v3? Which functions these 2 objects work together? How many conflict APIs between 2D and 3D functions stays there? I’ve a little bit of worry!!!