Jump to content

Parent Blender Mesh


DonKanallie
 Share

Recommended Posts

Hey Everyone,
 
I'm new to Babylon, but till now it worked great. I finished a little game for exercising with babylon, but now I'm trying to switch my main object to a blender object. I used a Box the whole time. Ok, for now i'm trying to append my new Blender Object to my box, thats all, but i can't figure it out. It's showing up, but i can't append it, so its flying with my ship(box).

 

Here is the relevant part of my Ship.js

var airplane;Ship = function (size, scene) {    BABYLON.Mesh.call(this, "ship", scene);    var vd = BABYLON.VertexData.CreateBox(size);    vd.applyToMesh(this, false);    BABYLON.SceneLoader.ImportMesh("", "assets/", "airplane.babylon", scene, function (newMeshes) {        airplane = newMeshes[0];        airplane.position.x = 6.5;        airplane.position.z = 0;        airplane.position.y = 6.5;        airplane.rotation.y = Math.PI*1.5;        airplane.material = new BABYLON.StandardMaterial("shipMat", scene);        //airplane.parent = vd;    });};

Would be great if somebody can help me =)

 

Cheers, DonKanallie

Link to comment
Share on other sites

Hey,

 

Maybe a stupid question: did you try without comment marks on this line?

//airplane.parent = vd;

Other than that, I don't see anything wrong. Are you sure there is only one mesh in your blender scene?

 

 

Also, there is a simpler way to create a box mesh:

var vd = BABYLON.Mesh.CreateBox("ship", size, scene);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...