Jump to content

Search the Community

Showing results for tags 'conditions'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 2 results

  1. I'll start off by saying I'm very new to Babylonjs so excuse my incompetence if I'm doing something silly. So I'm creating a town building sim and I'm handling the building creation by creating a grid of invisible cubes that can turn into specific buildings when clicked on in "Build Mode". I have a button that handles going in and out of "Build Mode" and it alternates a buildMode variable from true to false. What I'm trying to do is register the action that handles the highlighting of the build areas, the cubes, when buildMode equals "true" and unregister it when it equals "false". Here's how I'm handling it so far: scene.registerBeforeRender(function() { for(var i = 0; i < 144; i++){ var currentBox = scene.getMeshByName("box" + i); var overAction = new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOverTrigger, currentBox, "visibility", 1); var outAction = new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOutTrigger, currentBox, "visibility", 0); if(buildMode == true) { currentBox.actionManager.registerAction(overAction); currentBox.actionManager.registerAction(outAction); } else { currentBox.actionManager.actions.pop(overAction); currentBox.actionManager.actions.pop(outAction); } } }); It works going from buildMode false to true but not true to false, as in I click the button and build mode enables but it the actions are still working when I click the button again. Also, am I right in saying that I could maybe avoid all this if I just add a condition to the Action and add the action to the boxes when I first create them? I tried looking into that but I'm not really sure how BABYLON.ValueCondition works. As I said I'm pretty new at this so any help would be great.
  2. Sometimes the shader I am creating will be given an image file to use as a texture sampler and sometimes it will not. In the shader when the image file is given I need the line uniform sampler2D refTexture;and in the main function a line along the lines of float x = 0.5 * texture2D(refSampler, uv).rgb.x;and when no image file is given then float x = 0.5 * position.xFrom looking at the code in the samplers in the materialsLibrary I see there are some conditions on the uniforms such as #if defined(SPOTLIGHT0) || defined(DIRLIGHT0)varying vec4 vPositionFromLight0;uniform sampler2D shadowSampler0;#elseuniform samplerCube shadowSampler0;#endif1. Is there a condition I can use for #if ..................uniform sampler2D refTexture;#endif2. Is there a conditional statement within the main function I can use for IF texture loaded float x = 0.5 * texture2D(refSampler, uv).rgb.x;ELSE float x = 0.5 * position.xENDIF
×
×
  • Create New...