Jump to content

Search the Community

Showing results for tags 'local space'.

  • 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. Hello Everyone, I've been trying to go at this on my own but I've been stuck for days trying to add some basic AI to a cube. Play the FPS style game here on desktop or mobile: https://xtreemze.github.io/Ballistic you can find the full JavaScript here: https://github.com/xtreemze/Ballistic/blob/master/js/master.js Controls: touch the cube button on the bottom to shoot ice cubes and use standard universal camera controls to move and look around. Here's where I'm stuck: I got window.cube to jump and look at the camera but now I need a force to push the window.cube to move towards window.camera. I just can't figure out how to setLinearVelocity in the local forward direction of window.cube. redMesh is the Mesh of window.cube and redCube is the impostor of redMesh. (Also would be nice if the lookAt() rotation was eased or slowed down so it wouldn't seem so sudden but that's a lower priority.) Here's the part of the code that controls the cube AI and thanks in advance for taking a shot at this! // Global Scope Declarations for Console Tests window.button = button; window.cube = redCube; window.cubeMesh = redMesh; window.camera = camera; // Red Cube turns to look at camera const rotateCube = function rotateCube() { redMesh.lookAt(camera.position); }; // Cube Movement towards Camera ??? const jump = new BABYLON.Vector3(0, 5, 0); const front = new BABYLON.Vector3(0, -10, 0); const goForward = redMesh.getDirection(front); const moveCube = function moveCube() { redCube.setLinearVelocity(jump); rotateCube(); // redCube.setLinearVelocity(goForward); }; window.setInterval(moveCube, 2000);
  2. Likely a very simple question for the veterans Is it possible to convert a Vector3 given in world space coords to the local space of a mesh? Example: http://www.babylonjs-playground.com/#XMFZ0Z#3
×
×
  • Create New...