Lande Posted March 22, 2017 Share Posted March 22, 2017 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"; Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 22, 2017 Share Posted March 22, 2017 Ping @Nockawa Quote Link to comment Share on other sites More sharing options...
mirco Posted March 22, 2017 Share Posted March 22, 2017 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) Quote Link to comment Share on other sites More sharing options...
Lande Posted March 22, 2017 Author Share Posted March 22, 2017 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 GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Lande Posted March 22, 2017 Author Share Posted March 22, 2017 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. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 23, 2017 Share Posted March 23, 2017 Yep, that's actually a bug, if the text is too long there's a line returned happening. I'll fix it asap, it shouldn't be like that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.