Jump to content

Canvas2d WorldSpaceCanvas2d Text not shown


Lande
 Share

Recommended Posts

Hello everyone!. I'm trying to create new Canvas inside my scene and draw a text inside of it, but the text never appears. I must use WorldSpace because I am using Oculus Rift with WebVRFreeCamera.

 I have read a lot of posts and watched severad PG's without luck.

Here is my PG example:

http://www.babylonjs-playground.com/#H8NOA#2

Help would be appreciated!. Thanks!.

 var canvasTwo = new BABYLON.WorldSpaceCanvas2D(scene, new BABYLON.Size(4, 4), {            
            id: "WorldSpaceCanvas",
            worldPosition: new BABYLON.Vector3(0, 0.8, 0),     
            worldRotation: BABYLON.Quaternion.Identity(),                                         
            backgroundFill: "#ff000090"                 
        });

        var text2d = new BABYLON.Text2D("THIS IS WONDERFUL", {
            parent: canvasTwo,
            id: "subtitleLabel",
            fontName: "Bold 24pt Arial",   
            fontSuperSample: true,         
            defaultFontColor: new BABYLON.Color4(255, 255, 255, 0.7),
            marginAlignment: "h: center, v: center"            
        });

        //try update text
        text2d.text = "Updated test";
Link to comment
Share on other sites

19 minutes ago, mirco said:

I think the problem is that your "canvasTwo" is to small and your text to long.

new BABYLON.Size(100, 100) will make that the text appears (parts of it)

You are right, I was using the size of my scene, I updated and it is showing now, I'm gonna check if my scene works too. The measure in my scene is in meters and 400, 400 will be huge, I guess I should scale it.

Thanks!

http://www.babylonjs-playground.com/#H8NOA#4

 

Link to comment
Share on other sites

24 minutes ago, Lande said:

You are right, I was using the size of my scene, I updated and it is showing now, I'm gonna check if my scene works too. The measure in my scene is in meters and 400, 400 will be huge, I guess I should scale it.

Thanks!

http://www.babylonjs-playground.com/#H8NOA#4

 

It is working ok using 

canvas.worldSpaceCanvasNode.scaling.
 
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...