Deltakosh

Please welcome the TransformNode

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)

Share this post


Link to post
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).

Share this post


Link to post
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.

 

Share this post


Link to post
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.

Share this post


Link to post
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 :)

Share this post


Link to post
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.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.