使用TMXTiledMap对象,TMXTiledMap对象中的TMXLayer派生自SpriteBatchNode。
假设TMXTiledMap对象中有3层TMXLayer,创建一个Sprite3D小人,想和这3层做动态遮挡调整。
发现调用各TMXLayer的virtual void setGlobalZOrder(float globalZOrder);无效,查找发现注释:
Limitations: Global Z Order can’t be used used by Nodes that have SpriteBatchNode as one of their acenstors.
And if ClippingNode is one of the ancestors, then “global Z order” will be relative to the ClippingNode.
说明SpriteBatchNode无法使用setGlobalZOrder。
然后创建多个相机,想利用相机的渲染先后来实现遮挡,结果发现TMXLayer调用setCameraMask,使用新相机后,无法显示出来(但使用默认相机可以正常显示,但都会遮住3D对象)
如何才能使3D人物在TileMap中正确的遮挡??