–创建相机,cc.CameraFlag.USER1
local ws=cc.Director:getInstance():getWinSize()
local bgc=cc.Camera:createPerspective(60.0, ws.width / ws.height, 0, 1000)
bgc:setCameraFlag(cc.CameraFlag.USER1)
bgc:setPosition3D(cc.vec3(ws.width/2,ws.height/2,800))
bgc:lookAt(cc.vec3(ws.width/2,ws.height/2,0), cc.vec3(0,1,0))
scene:addChild(bgc)
--创建文本,cc.CameraFlag.USER1
--local txt=ccui.Text:create("PLAYER123456","fonts/Marker Felt.ttf",100)
local txt=cc.LabelTTF:create("PLAYER123456","fonts/Marker Felt.ttf",100)
txt:setCameraMask(cc.CameraFlag.USER1,true)
txt:setPosition(cc.p(300,600))
--创建Armature,cc.CameraFlag.USER1
ccs.ArmatureDataManager:getInstance():addArmatureFileInfo("Bike1/Bike10.png","Bike1/Bike10.plist","Bike1/Bike1.ExportJson")
local bike=ccs.Armature:create("Bike1")
bike:setCameraMask(cc.CameraFlag.USER1,true)
bike:setPosition(cc.p(300,600))
--加入场景
scene:addChild(bike)
scene:addChild(txt,100)
代码如上,创建了一个CameraFlag为USER1的相机,创建了2个CameraMask都为USER1的对象,只不过一个是文本LabelTTF,一个是Armature
运行结果是,Armature可以正常显示,但是LabelTTF无法显示,Text我试了,也不行
这是为什么?