问题描述:
1.使用 3dmax 导出 obj 文件,cc.Sprite3D:create 加载成功但是无法看到该模型。
2.使用 3dmax 导出 fbx 文件,再使用 fbx-conv.exe 转换成 c3t 和 c3b 文件, 分别用这两个文件进行测试,仍然存在同样的问题。
cocos2d-x 版本:3.3 rc0
由于我的陨石图片yungshi_01.png (
yungshi_01.png 并没有拼写错误,因为3dmax 中的材质使用的图片名就拼成了yungshi_01.png)为褐色,为了排除和背景色黑色相近导致看不清的问题,我把背景色调为绿色(cc.LayerColor:create(cc.c4b(0, 255, 0, 255))),问题仍然存在。
为了排除我的lua代码问题,我尝试了其他3d模型文件,可以正常显示,说明我的lua代码没有问题。
3d模型说明:这是一个简单的模型,没有骨骼动画。3dmax 版本为2012
由于我对3d模块不熟悉,暂时没有能力解决这个问题,还希望有人能帮忙解决,谢谢。
相关的文件我将在附件中给出。
代码如下:
local Sprite3DMyTest = {}
Sprite3DMyTest.__index = Sprite3DMyTest
function Sprite3DMyTest.addNewSpriteWithCoords(parent,x,y)
local sprite = cc.Sprite3D:create(“Sprite3DTest/yunshi_01.obj”)
sprite:setScale(3.0)
sprite:setTexture(“Sprite3DTest/yungshi_01.png”)
parent:addChild(sprite)
sprite:setPosition(cc.p(x,y))
end
function Sprite3DMyTest.create()
– local layer = cc.Layer:create()
local layer = cc.LayerColor:create(cc.c4b(0, 255, 0, 255))
Helper.initWithLayer(layer)
Helper.titleLabel:setString(“Testing My Sprite3D”)
Sprite3DMyTest.addNewSpriteWithCoords(layer, size.width / 2, size.height / 2)
return layer
end


?