你好,我尝试用png对球体进行纹理化,但是它错误地应用了纹理并将其弄乱了。我找不到任何方法来移动它并使用纹理/材质,直到将其正确设置为止。我想创建一个足球并应用它的球纹理这是我用来创建材料并应用它的代码谢谢
[Embed(source=”../assets/Ball.png”)]
public static var TheBallTextureClass:Class;
public var TheBallMaterial:TextureMaterial;
var theball:Mesh;
TheBallTexture = new BitmapTexture(new TheBallTextureClass().bitmapData);
TheBallMaterial = new TextureMaterial(Cast.bitmapTexture(TheBallTexture));
TheBallMaterial.smooth = true;
TheBallMaterial.repeat = true;
theball = new Mesh(new SphereGeometry(30), _ballMaterial);
这是因为SphereGeometry的UV映射很奇怪,而不是针对像足球这样的图案制作的。
我建议您在3ds max中创建球体并将其解包。
编辑:如果需要,可以在Away3D中编辑SphereGeometry的UV映射:
创建SphereGeometry的子类,并覆盖“ buildUVs(target:CompactSubGeometry)”,创建您自己的UV集。