Jump to content

Using extension .obj Loader


wayan
 Share

Recommended Posts

Hi all,

I'm still beginning on learning how to use babylon js, so for now i just playing a little with babylon playground. 

right now i just make play ground to combine example of using extention .obj loader and function of drag and drop at default babylon playgorund sample. the play ground i make is working (what i mean is the drag & drop is function and the .obj file is loaded) but i found something funny here, how to fix it maybe :

- the ground(camera) can't rotate if i not drag and drop any object before 

- the .obj file why is it so small, is there a way to make it bigger like the example of using .obj loader ?

- when i try to drag the 3D object, the object separate like : when i click and drag "bane" i just drag their 3d feet, body, head or cloth differently, not all full body of the 3D object and it looks quite funny to see it :lol:

 

I wonder how to fix this.

here my playground : http://www.babylonjs-playground.com/#HV0EA

 

thanks alot,

wayan

Link to comment
Share on other sites

@Deltakosh

Hello Delta,
Thank you very much for update my playground, it's solve my two problem :)

but as the other issue about when i drag the 3d, it's not full 3d that got move and dragged but they got separated, is there a way to fix it too...? so when i want to drag its not got separated (full body of batman, penguin or bane) not their legs, head or costum maybe.

i give some screentshot about what i mean 

 

thanks alot

 

error.png

Link to comment
Share on other sites

Hi wayan :) Welcome to the BJS Forum.

I downloaded your batman figure and took a look at it in Blender (see image below).

As you can see it is made of 7 meshes - so when you click & drag on one of them - it comes apart.

You have the option of taking the object file into a 3D program like Blender and merging the meshes - you end up then with just one mesh.

Problem you then face is that you will now have to clean up the UV maps.

cheers, gryff :)

 

batman1.png

Link to comment
Share on other sites

@wayan

A thought on your problem wayan.

Try this with just the Batman obj file:

1. Load the obj file

2. Then in your javascript code :

var Batman = scene.getMeshByName("BatmanTorso");
Batman.isPickable = true;

3. Repeat the procedure for all the other parts except make all these other parts "unpickable" and then parent them to the Batman part, so for example:

var mask = scene.getMeshByName("BatmanMask");
mask.isPickable = false;
mask.parent = Batman;

Hopefully clicking and dragging on the torso will move the whole dude around.

cheers, gryff :)

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...