Jump to content

BJB doesn't have Sprite(HUD) like Three.js


Recommended Posts

you can use the sprites with a dynamic texture containing a text

or simply a plane mesh set in billboard mode


i am using dynamicTexture with context drawed text. as opacityMaterialTexture. and attach to a plane mesh...

and i should update the mesh's rotation according to camera alpha and beta...

i think it's not a good way.


i'll try 'billboard'. maybe it's the final solution?

Link to comment
Share on other sites

this.nameMesh.billboardMode = BABYLON.AbstractMesh._BILLBOARDMODE_ALL;


it's fine, and i needn't set rotation myself. but it'll be covered by other object.



the sprites: should use spriteManager but


 function SpriteManager(name, imgUrl, capacity, cellSize, scene, epsilon, samplingMode)


it's also not convenient...

Link to comment
Share on other sites

There are probably many ways to do this.  Billboard always faces the camera.  Moving with the Mesh in 3D can be compelling.  Sprites are for pussies.  This is done by adding a registerAfterWorldMatrixUpdate() to the mesh you wish to track.  Every time the tracked mesh moves the label moves.



in <head> add    <script src="dialog.1.1.js"></script>    <script src="Font2D.js"></script>...DIALOG.DialogSys.initialize(scene);// want emissive color, so does not change under lighting, backface culling off for wooshvar alwaysWhite = new BABYLON.StandardMaterial("alwaysWhite", scene);alwaysWhite.checkReadyOnlyOnce = true;alwaysWhite.emissiveColor  = new BABYLON.Color3(1,1,1);alwaysWhite.backFaceCulling = false;var offAway = new DIALOG.Label("Off & Away","Font2D", alwaysWhite);offAway.layout();offAway.unfreezeWorldMatrixTree();offAway.rotation.y = -3.14 / 2;cloth.registerAfterWorldMatrixUpdate(    function(){        offAway.position.x = cloth.position.x;        offAway.position.y = cloth.position.y + 3;        offAway.position.z = cloth.position.z;    });
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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...