Jump to content

Parenting corrupts child mesh's position


alanz2223
 Share

Recommended Posts

Hi I have a missile I am importing into babylon from blender, the missile's propellers and small outer accessories are parented to the main body of the missile. The problem is that whenever I place it into my babylon scene the all the child elements are out of place, as if they took on the properties of the parent object (All i want to do is have rotations applied to the parent, apply to the children as well). Here is the .babylon file if you would like to place it into the sandbox.

 

 https://www.dropbox.com/s/a038ipq37a7cku6/AimParented2.babylon?dl=0

Link to comment
Share on other sites

I ran into this problem when trying to import more then one mesh in a .obj file that did not have their origin aligned to 0,0,0.  My solution was to separate the objects and import them as separate files (im sure there is a better way to do this but this was my c4d to babylon work around)
So make them separate objects, and import them and such... once they are in the scene take the object that you want as a child and set its parent so:

var childA = BABYLON.Mesh....;
var childB = BABYLON.Mesh....;

var parentObj = BABYLON.Mesh....;


childA.parent = parentObj;

childB.parent = childA;


now any transformations to the parent object will move both of the children, a movment to childA will move both childA and B and a movment to B will only affect B...

I hope I was clear enough, sorry I was doing this answer on a 5 min break from working...
 

Link to comment
Share on other sites

transform them after they are parented and rotate and position then as they are needed.... you can always move them after they are parented.

also by looking at your model, why not just retopologize it and make the wings and the body all a single model? this will save on draw requests.

post a drawing of what it is supposed to look like, or a screen shot and I will whip something up for you right now that will perform better for you. also it looks like your texture is reversed and needs to be mirrored horizontally

Link to comment
Share on other sites

Well I can only do basic modeling and don't even know what retopologize is, sorry. The reason I didn't join the mesh into a single object is because I would like to have the back propellers split from the body and leave only the payload as an animation before it explodes. Anyways I really appreciate your aid, I suppose if you would like to help it would be much easier to download the almost complete model than to start from scratch. I downloaded it from blendswap @ http://www.blendswap.com/blends/view/22736

Link to comment
Share on other sites

I got you friend, I needed a reason to test my playground extensions so after I finish some of those ill simulate a surface to air middle for you complete with a trajectory and target tracking system.  Stay tuned it might not be done tonight but in the next day or so.

Link to comment
Share on other sites

Here is your missile, I mocked up really fast, you can always draw more complex textures over it.
Ill get to rigging it and showing and example of how to use a simplified mesh imposter.

I decided to keep the wings attached because... that's what missiles do, not one rocket or missile ejects its fins prior to impact.  Now having them unfold out of the launcher is realistic and totally possible but Ill do this "rigged" missile first to demonstrate some concepts for you.

 

m1.png

Link to comment
Share on other sites

That looks great, good thing that missiles don't really have complex animations, its just the frame spinning on an axis, but what I essentially want to do is have the rocket be controllable (like a valkyrie rocket from COD) before it explodes into a war plane. I think this is a great start.

Link to comment
Share on other sites

I still plan on helping you with this, I am just super overloaded at the moment with demanding clients who all want their systems done yesterday so yeah, give me a second I'm interested and doing a simulation like this for my own reasons as well though so I'll make sure to keep you posted

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