Jump to content

Search the Community

Showing results for tags 'update positions'.

  • 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 1 result

  1. Hello, After I update the mesh positions I faced some problems, 1- All actions I registered to the mesh no longer work 2- I can't click on the mesh scene.onPointerDown = (event, pick) =>{ console.log(pick.pickedMesh) } always returns null. my code var canvas = document.querySelector("#renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function () { var scene = new BABYLON.Scene(engine); scene.clearColor = BABYLON.Color3.Gray(); var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -20), scene); camera.setTarget(BABYLON.Vector3.Zero()); camera.attachControl(canvas, false); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); light.intensity = .5; return scene; }; var scene = createScene(); engine.runRenderLoop(function () { scene.render(); }); var mesh = new BABYLON.Mesh('mesh', scene); var vrtxData = new BABYLON.VertexData(); var pos = [0, 0, 0, 5, 0, 0, 5, 0, 5]; var indices = [0, 1, 2]; vrtxData.positions = pos; vrtxData.indices = indices; vrtxData.applyToMesh(mesh, true); var material = new BABYLON.StandardMaterial('m', scene); mesh.material = material; material.diffuseColor = BABYLON.Color3.Red(); mesh.actionManager = new BABYLON.ActionManager(scene); mesh.actionManager.registerAction( new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOverTrigger, mesh.material, "diffuseColor", BABYLON.Color3.Green()) ) mesh.actionManager.registerAction( new BABYLON.SetValueAction(BABYLON.ActionManager.OnPointerOutTrigger, mesh.material, "diffuseColor", BABYLON.Color3.Red()) ) // move mesh to the right for (var i = 0; i < pos.length; i += 3) { pos[i] += 5; } mesh.updateVerticesData(BABYLON.VertexBuffer.PositionKind, pos); scene.onPointerDown = (event, pick) =>{ console.log(pick.pickedMesh.name) }
×
×
  • Create New...