| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/02/2010 13:33:06
|
Benji benji
Joined: 29/09/2009 16:33:12
Messages: 36
Offline
|
Hello,
i created a class were i create a 3 object and load its informations
now i want to create an object from this class and add this object to the scene
but i get the error message: class "wall" is not a object 3d...
how can i parse it into a 3d object?
if i try "wall as object 3D" theres no error before starting, after starting i get the error that he cant add a empty object on scene.
here are the code snipet
//Here i want to add the class on scene:
wall1 = new wall(10,10,10,0);
scene.root.addChild(wall1);
//here code from class wall
public function wall(xPosl:int,yPosl:int,zPosl:int,rotationl:int)
{
xPos = xPosl;
yPos = yPosl;
zPos = zPosl;
rotation = rotationl;
wandLoader = new Loader3DS();
wandLoader.smooth = true;
wandLoader.precision = TextureMaterialPrecision.HIGH;
wandLoader.load("resource/wand/wand2.3DS");
wandLoader.scale = 0.2; // Danou verkleinert
wandLoader.addEventListener(Event.COMPLETE, onWandloadingComplete);//parameterübergabe
}
private function onWandloadingComplete(e:Event) {
for (var o:* in wandLoader.content.children) {
var object:Object3D = o;
weldVerticesAndFaces(object);
//scene.root.addChild(object);
//scene vorhanden?
}
}
private function weldVerticesAndFaces(object:Object3D):void {
if (object is Mesh) {
MeshUtils.autoWeldVertices(Mesh(object), 0.01);
MeshUtils.autoWeldFaces(Mesh(object), 0.01, 0.001);
}
// Launching procedure for object's children for wall1
for (var key:* in object.children) {
weldVerticesAndFaces(key);
}
object.x = xPos;
object.y = yPos;
object.z = zPos;
object.rotationZ =rotation;
// funktion on klick
object.addEventListener(MouseEvent3D.MOUSE_DOWN, onSWF);
}
any idea how i can solve that problem?
mfg Benji benji
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/02/2010 13:52:42
|
makc
Joined: 02/06/2008 12:19:17
Messages: 786
Offline
|
Benji benji wrote:Hello,
i created a class were i create a 3 object and load its informations
now i want to create an object from this class and add this object to the scene
but i get the error message: class "wall" is not a object 3d...
here
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/02/2010 19:20:31
|
Benji benji
Joined: 29/09/2009 16:33:12
Messages: 36
Offline
|
can you give me maybe a small codesnipet? i dont understand what to do with this class or how to use it?
how can this help to solve my problem?
mfg Benji benji
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 02/02/2010 19:36:48
|
Mehdadoo !
Joined: 15/06/2009 22:12:14
Messages: 189
Offline
|
You can not add an arbitrary class like the Event class to the scene, can you? Only instances of Object3d are supposed to be passes to the addChild() method of a 3d scene
Your class must extend the same Object3D.
And if you bother posting a project, we don't need to create everything from scratch to show you what we mean!
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 03/02/2010 16:30:38
|
Benji benji
Joined: 29/09/2009 16:33:12
Messages: 36
Offline
|
Mehrdad Sanjabi (aka Mehdadoo) kolhoz™ wrote:You can not add an arbitrary class like the Event class to the scene, can you? Only instances of Object3d are supposed to be passes to the addChild() method of a 3d scene
Your class must extend the same Object3D.
And if you bother posting a project, we don't need to create everything from scratch to show you what we mean!
yeah youre right. I tought at the wrong way i solved it on other way but thx for help.
I didn´t need to parse it into an object3d
but thanks anyway
|
|
|
 |
|
|