actionscript-3flashtexturesaway3d

Away3d aplying texture/ matterial issues


Hello i try to texture a sphere with a png but it apply the texture wrong and messes it up. i cant find any way to move it around and play with the texture/material untill it will be set correctly. i want to create a soccer ball and to apply it a ball texture This is my code i use to create the material and apply it Thanks

[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);

Solution

  • That's because the UV Mapping of the SphereGeometry is weird and is not made for a pattern like the soccer ball.

    I suggest you to create the sphere in 3ds max and unwrap it there.

    EDIT: If you want you can edit UV mapping of SphereGeometry inside Away3D:

    Create a SubClass of SphereGeometry and override "buildUVs(target:CompactSubGeometry)" creating your own set of UVs.