protected var scene:Scene3D;
protected var camera:Camera3D;
protected var view:View3D;
public function Away3DTemplate() {
initUI();
initEngine();
initScene();
initListeners();
}
protected function initEngine():void{
view = new View3D();
scene = view.scene;
camera = view.camera;
addChild(view);
view.x = stage.stageWidth / 2;
view.y = stage.stageHeight / 2;
}
protected function initListeners():void{
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function onEnterFrame(event:Event):void{
view.render();
}
protected function initScene():void{
}
protected function initUI():void{
}
}
}
still have errors, could you help me?
ganesh, Member Posted: 08 September 2012 03:35 PM Total Posts: 54
[ # 1 ]
hi, If you are using Away3d 4 gold with tutorials of “away3d 3.6 essentials” then you will surely get errors, because some old classes/packages may not be available in latest Aways3d 4 src folder.
I also started this way but later I had to change my way of learning, now I browse net for tutorials away3d 4gold and practice them
azaroth, Newbie Posted: 08 September 2012 03:46 PM Total Posts: 8
[ # 2 ]
Hey, thank you for your answer, i thought to do the same, but i want to learn the library in a specific order, and in the net i find splited tutorials, so my head gets meshed up
azaroth, Newbie Posted: 09 September 2012 06:27 AM Total Posts: 8
[ # 3 ]
ok i went to a simplier example with just a sphere (latest away3d version) but still full errors:
private var view1:View3D = new View3D;
private var scene1:Scene3D = new Scene3D;
private var camera1:Camera3D = new Camera3D;
private var sphere1:Sphere = new Sphere;
ganesh, Member Posted: 09 September 2012 09:31 AM Total Posts: 54
[ # 4 ]
I think you are still following old 3.6 book samples with away3d gold. I took your code and tried them, initially I also got lots of errors. Then I edit these lines
import away3d.primitives.SphereGeometry; // primitives.Sphere
import flash.display.Sprite; // added this line
public class hovercam extends Sprite // public class hovercam
private var sphere1:SphereGeometry = new SphereGeometry;// Sphere
Now the error reduced to only one “1067: Implicit coercion of a value of type away3d.primitives:SphereGeometry to an unrelated type away3d.containers:ObjectContainer3D.”
I think it is because you have not setup the codes correctly and also I have some confusion with your codes can you explain the below codes of your.
private var view1:View3D = new View3D; // its ok
private var scene1:Scene3D = new Scene3D; // its ok
private var camera1:Camera3D = new Camera3D; // its ok
view1.scene= scene1; // here view1.scene is scene1 but above you have just defined scene1 is a type scene3d, is it possible that scene1 is both type view3d and scene3d at a time?
view1.camera = camera1; // same confusion here, camera1 is camera3d plus view1.camera at a time.
camera1.z = -1000; // which camre is this view1.camera or private var camera?
scene1.addChild(sphere1); // which scene1 is this view1’s scene or private var scene?
I am completely new to away, so if you find my questions silly plz then explain it.
Have you tried example that comes with away3 4 gold package?
azaroth, Newbie Posted: 09 September 2012 10:36 AM Total Posts: 8
[ # 5 ]
Hey, i will check the code and tell you, where can i find that example you mentioned?
ganesh, Member Posted: 09 September 2012 11:32 AM Total Posts: 54
[ # 6 ]
azaroth, Newbie Posted: 09 September 2012 12:39 PM Total Posts: 8
[ # 8 ]
Yeah it also worked on mine, but could you explane me the “mesh”? Also where can i find a freaking complete guide to away3d 4? How are we supposed to learn the library?
azaroth, Newbie Posted: 09 September 2012 12:46 PM Total Posts: 8
[ # 9 ]
ganesh, Member Posted: 09 September 2012 01:22 PM Total Posts: 54
[ # 11 ]
I don’t know your level of expertise, but about me I did some works with AS2, then a full one year break no touch with flash, now I am again busy to learn flash, but since then flash has advanced a lot now it is AS3, and so many engines out there.
About mesh, I also practiced and learn 3dmax 10 few year back, and then I came to know that Mesh is actually a face. For example to make a triangle you need three points at any distance and then you connect these points/vertices with straight line, when your triangle is ready you get an area or boundary. Now, this boundary is empty this is called wireframe triangle, and if you fill this triangle with some color you get a face. This face is also called mesh or poly.
The first code example is a filled Sphere, that’s why we need to import mesh to apply color in it, and the last code I sent here is a wireframe only thats why we dont need mesh and we can render it directly
Before we go further, let me know your expertise level, so that, we can learn together and faster.
Fabrice Closier, Administrator Posted: 09 September 2012 02:13 PM Total Posts: 1265
[ # 12 ]
@ganesh A Mesh is not a Face. A Mesh is a collection of 1 or more faces. A face in Away3D is a triangle definition. It’s called ‘mesh’, because when you would connect each points of every triangles with a line it would “look” like a web or some kind of a net.
azaroth, Newbie Posted: 09 September 2012 02:59 PM Total Posts: 8
[ # 13 ]
Hey again, finaly i found a “way” i downloaded the book “the essential guide to 3d flash” which uses away3d 3.6 I hope i dont miss any awesome content with 3.6 version instead of 4, but its the only way, im also gonna check the links My experiance lvl is amature, @genesh gimme your mail to speak privately about the learning together
80prozent, Sr. Member Posted: 09 September 2012 03:33 PM Total Posts: 430
[ # 14 ]
hi azaroth
i dont think learning 3.6 instead of 4 is that good choice.
3.6 was before flashplayer11 and the stage3d, and is working 100% on the cpu.
working with the gpu enables you to process a lot more data, while using less of your cpu power.
at this point away3d 4 even lack some of the features the 3.6 library had, but every feature that is implemented in the gold version is much better than the 3.6 version.
it might be a bit hard to get your head arround the gpu way of working with meshes, but once you understand the principles, using away3d 4 will get much easier.
ganesh, Member Posted: 09 September 2012 03:45 PM Total Posts: 54
[ # 15 ]
@ Fabrice Closier
Thanks for clearing the concept. So a face is a very basic thing, and mesh is container of faces. right?
can you please tell me that, we can add wirefregeometry directly to a scene and renders it, and it works, but we cant add sphere directly to a scene, because when rendering them compiler throw erros. Why a sphere must be added to a mesh and then we add mesh to the scene before rendering?