Jump to content

Ask for help about basic concept of mesh


Herbert
 Share

Recommended Posts

Hi there,

I am very new to babylon and 3D area, I saw this demo from tutorial and I have some question,
https://www.babylonjs-playground.com/#1BZJVJ#30
1) I want to import a mesh of a character, why would it end up with an 'array' of newMeshes and skeletons.
2) If there is an array of meshes, why it only change the position of the one at '0'(newMeshes[0]) and it works for all meshes.
3) Same for skeletons, in this demo, there is only one skeleton, but if there are more than one, should I loop for every skeleton to call beginAnimation?
 

skeletons.forEach((singleSkeleton) => {
    var animation = scene.beginAnimation(singleSkeleton, 0, 100, true, 1.0);
});

I know these questions might be very basic, is there any article recommended?

Link to comment
Share on other sites

Hi @Herbert,

All are good beginners' questions. I will hint in the right direction (with a simple explanation), and you can search further in the documentation page :)

1) You are not loading a mesh, you are loading an object, that might consist of many different meshes connected together. "The Dude" is a wonderful example for that. It consists of 5 different meshes that constructs the entire model. They are all connected using a parent mesh, which is the answer to question 2.

Why do we do that? The example you pasted is a wonderful one. If you want to change the scale of the head, and the head alone, you will need the head isolated from the rest, so you can apply a transformation only on this specific object. If you want to remove an item of clothing, it would be very helpful to have it as a mesh.

2) Parenting system! In Babylon you can define a node object (like a mesh) to be the parent of a few other objects. It is eventually a tree of nodes (in our case meshes). You can see that clearly in the debug layer:

image.png.b19a8dc704dd11796227b5e705fca5d0.png

Why do we do that? So we can move the dude using a single command, and not move 5 different objects every time. So we can apply global scaling and rotation. So the scene will be structured and organized.

3) Check out the relations between Skeleton and Bones, and see if it makes more sense afterwards - http://doc.babylonjs.com/tutorials/how_to_use_bones_and_skeletons . Also play with the debug layer to understand better which mesh has bones.

 

I hope this helps!

Link to comment
Share on other sites

hi @RaananW,
Thanks for your really quick and clear explanation:),  I think I get the idea for the first two questions, as for the third one

56 minutes ago, RaananW said:

3) Check out the relations between Skeleton and Bones, and see if it makes more sense afterwards - http://doc.babylonjs.com/tutorials/how_to_use_bones_and_skeletons . Also play with the debug layer to understand better which mesh has bones.


I know that a skeleton contains bones, but I can't find the relation between mesh and skeleton nor mesh and bones.
 Although there is an attribute of mesh called skeleton, it's undefined, so how does skeleton link to and influence mesh.

 

Link to comment
Share on other sites

So!

A skeleton has a lot of bones, and a mesh has a reference of a skeleton. The skeleton's definitions tell vertex information of the mesh how to change, so it will create this specific animation. 

You can see that the meshes in the .babylon file are referencing skeletonId (which is all the same, since the same skeleton can be applied to different meshes at the same time)

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