newbie help on bitmapMaterial

Software: Away3D 4.x

charlito, Jr. Member
Posted: 14 March 2012 01:44 PM   Total Posts: 36

hi..

i finally was able to create simples primitives and render them on stage.
but when i try to add a custom jpg texture it fails..
my code is:

[Embed("assets/texturaCaja2.jpg")]
 
private static const myPic  : Class;
  
 public function 
away3dBasico_v001()
 
{
 addChild
(view);
 var 
sphere:SphereGeometry = new SphereGeometry(100);
 var 
texture_sphere:BitmapMaterial = new (new myPic().bitmapData);
 var 
mesh:Mesh = new Mesh(sphere,texture_sphere);
   
 
view.scene.addChild(mesh); 

it tells me:
3604:use texture composition instead of inheritance..


besides it doesnt accept me the rotation instructions

sphere.rotationX=6;
//nither
phere.roll(5) ; 

thx in advance for all ur help.

   

Avatar
Matse, Sr. Member
Posted: 14 March 2012 03:07 PM   Total Posts: 149   [ # 1 ]

Unless you’re using a quite old version of away3D 4, you should not use BitmapMaterial anymore I think.

First create a BitmapTexture from your bitmapData, then create a TextureMaterial that uses the BitmapTexture :

var texture_sphere:BitmapTexture = new BitmapTexture(new myPic().bitmapData);
var 
material_sphere:TextureMaterial = new TextureMaterial(texture_sphere);
var 
mesh:Mesh = new Mesh(spherematerial_sphere); 

Also this line in your code is messed up :

var texture_sphere:BitmapMaterial = new (new myPic().bitmapData); 

that should have been new BitmapMaterial(...), not new “nothing” wink

Finally, when rotating a sphere if it doesn’t have some texture you won’t be able to see it rotate as it looks the same whatever the angle.

   

charlito, Jr. Member
Posted: 14 March 2012 04:15 PM   Total Posts: 36   [ # 2 ]

dude..

just wanna say Thank you a lot…  this is so hard for me..

now i got my sphere rotating(with texture)...  i know its silly but, im happy XD

if any1 knows a good (uptodate) tutorials, i really appreciate..

plz forgive my bad english.

thx again.. u were extremely useful
greetings

 

   

Avatar
Matse, Sr. Member
Posted: 14 March 2012 05:57 PM   Total Posts: 149   [ # 3 ]

You’re welcome, and your english is ok : I’m not a native english speaker either, as long as what you write is understandable it’s all good wink

I understand your feeling, nothing silly about that it’s great when you get something working !

I don’t think there are many tutorials out there, I don’t know any. Your best bet for now is probably to learn using the examples and the forum.

Also 3D engines tend to work the same : I used shockwave3d for 10 years, when I started Away3D I didn’t have to learn everything from scratch, just the specifics. So in some cases it might be a good idea to not only search about away3d… sorry I can’t think of a good example right now so I hope I’m understandable smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X