Search the Community
Showing results for tags 'dynamic text'.
-
Hello Masters, Need help to add 2-d text from babylon on the object which is blender object.The text should not be go outside of the rendered object. Can you please help me to short out this issue? It would be great if anyone have the example.
- 12 replies
-
Hi All I have been researching dynamic text rendering within the forum and found various solutions (most orientated around drawing text on a 3D plane). This led me to create a simple code snipplet that illustrates how the technique might be used: http://playground.babylonjs.com/#12MQQ3 What I attempted here was to create a function that renders a label in a 3D scene - as you can see it works, but it quickly became apparent that the size of the objects in the scene will have a severe impact on the labelling. In the example above the object (sphere) is very large and this results in the label above it appearing very small (even though the font size is 100px). I could increase the size of the texture/plane but this will utilise more memory/resources and will not be a good solution for me as I am attempting to create a 3D chart. NOTE: when setting debug mode the labels displayed are "exactly" what I am trying to acheive - e.g. So at this time I am wondering how I can efficiently render text labels on top of a 3D scene, whereby each label is connected to a 3D object (and therefore moves with it). NOTE: I do not want the text to rotate. If anyone can advise on this topic (possibly provide a PG code example) I would appreciate it. Thanks
-
Hi I'm a newbie with pixi and am really enjoying it, I am creating a simple game but I cannot get the scoreboard to update dynamicaly, I can see the score increase in my console.log(score) but the number on screen remains at number 1. I have looked at online and at the manual and have tried .content but to no avail, what am I doing wrong ? I losing my hair Below is my basic script : var Container = PIXI.Container, autoDetectRenderer = PIXI.autoDetectRenderer, Graphics = PIXI.Graphics, Sprite = PIXI.Sprite, MovieClip = PIXI.extras.MovieClip, TilingSprite = PIXI.extras.TilingSprite, loader = PIXI.loader, resources = PIXI.loader.resources, Text = PIXI.Text; TextureCache = PIXI.utils.TextureCache, Texture = PIXI.Texture; //Create a Pixi stage and renderer var stage = new Container(), renderer = autoDetectRenderer(256, 256); document.body.appendChild(renderer.view); //Scale the canvas to the maximum window size var scale = scaleToWindow(renderer.view); //Set the initial game state var state = play; //load resources loader.add("images/player.png") .load(setup); //Define any variables that might be used in more than one function var gameScene = undefined, // container state = undefined; score =1; message = undefined; function setup() { gameScene = new Container(); stage.addChild(gameScene); message = new Text(score, {fill:"white"}); gameScene.addChild(message); state = play; //Start the game loop gameLoop(); } function gameLoop() { //Loop this function 60 times per second requestAnimationFrame(gameLoop); //Run the current state state(); //Render the stage renderer.render(stage); } function play() { score++; message.content = score; console.log(score); } Thanks in advance to anyone who can help me Eric
- 1 reply
-
- pixi.js
- dynamic text
-
(and 1 more)
Tagged with: