Jump to content

Please welcome the TransformNode


GameMonetize
 Share

Recommended Posts

I know this was a big ask from the community so I'm glad to announce that we finally support TransformNode!

They are node with position / scaling / rotation like any mesh but without all the rendering. So they are just here to add transformation to a hierarchy.

Example:

https://www.babylonjs-playground.com/#JT0HN4

@JohnKsorry my friend because this could require some update to the doc (even if by itself everything will keep working the same as before)

Link to comment
Share on other sites

" export class AbstractMesh extends TransformNode "

mesh.transformManager = new BABYLON.TransformManager(scene);

err... wait, no.  :)

But it looks like transformNode will be taking-over the rotation, position, and scaling duties... from abstractMesh.  Work-load delegating!  :) 

AbstractMesh was getting pooped-out too easily.  Geritol costs are skyrocketing!  heh. 

No sign of wedging transformNode into lights or cameras.  Mesh only.

Works for Quaternions, too!

https://www.babylonjs-playground.com/#JT0HN4#1

PARTY!  Looks like there might be physics plugin affects, too.  (Wingy hides under his fridge.)  :)

(Wingy shakes transformNode's hand and welcomes him/her it to the framework).

Link to comment
Share on other sites

@Deltakosh why not more simply "Transform" instead of "TransformNode"? ;) At least according to the Class documentation, "Transform" isn't currently in use and there doesn't seem to be much precedent for appending "Node" to other class names. Plus "Transform" has some nostalgia for me as it exists with almost identical functionality in VRML, X3D & Inventor. No big deal, just a suggestion.

 

Link to comment
Share on other sites

I have some ideas to improve it a bit.
- (this more like a bug) dispose() does not remove the TransformNode from the Scene. transformNodes array

- dispose() should also dispose all the children (meshes and other transform nodes) of the current node, just like the dispose function of AbstractMesh
currently its a bit complicated to dispose a whole hierarchie if Meshes and TransformNodes are mixed

- there should be a getChildTransformNodes() helper just like getChildMeshes()

I could work on a PR if you want.

Link to comment
Share on other sites

Hey!

1. dispose() does not remove the TransformNode from the Scene.: https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L3850

2. dispose() should also dispose all the children: Excellent point! will fix it

3.getChildTransformNodes() helper just like getChildMeshes(): Yeah! WIll do it as well :)

Link to comment
Share on other sites

 

3 hours ago, Deltakosh said:

The transformNode can be seen as a point so this is not possible to get a center :(

I gotcha... give me a few minutes. 

https://www.babylonjs-playground.com/#JT0HN4#5

this is broken but is how you would do it... I don't have time today to go back over it but this should get you in the right direction. (not sure why its not working in theory this should have done it, I must just be missing something small.)

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