Jump to content

Search the Community

Showing results for tags 'decompse'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Not sure if this is a bug or just my misunderstanding. I am trying to make a mesh parent of another mesh without changing the transforms (position, rotation and scaling) of the child mesh in the world frame of reference Similar to this discussion Keep child's world position when parenting As shown in the above discussion I use the following kind of function to do this function makeParent(child, parent) { var invParentMatrix = Matrix.Invert(parent.getWorldMatrix()); var newMatrix = child.getWorldMatrix().multiply(invParentMatrix); newMatrix.decompose(child.scaling, child.rotationQuaternion, child.position); child.parent = parent; } This works fine as long as the scaling of the parent is the same in x, y and z direction. It breaks down if I change the parent scaling in any one of those direction. Here is a playground example http://www.babylonjs-playground.com/#28IXSE#4 Here we have two meshes - box1 and box2. I am trying to make box1 parent of box2. Clicking the canvas calls a parenting function (similar to the one above) to do so. To try First time, do a Run and then click the canvas. box1 will become parent of box2 and nothing will change on the screen - as expected. Second time uncomment line 19 - this changes the scale of box1 in the z direction. Again click run and then click the canvas. This time box2 is distorted. Sorry for the long post. I have spent hours on this and can't figure out what's wrong
×
×
  • Create New...