Search the Community

Showing results for tags 'inputs'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

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 7 results

  1. Hi guys and gals, I was reading the docs on Customizing Camera Inputs https://doc.babylonjs.com/how_to/customizing_camera_inputs and I want to customize the camera input for the FollowCamera. But it has no camera.inputs set at the moment when I look at the definition: https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.followCamera.ts While for example the FreeCamera has: https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.freeCamera.ts#L164 My question is: Can you set the camera.inputs to a new CameraInputsManager instance? Perhaps a DummyCameraInputsManager that's just an empty shell, doesn't need to do anything with input for now... just being there. So then I can add my own inputs to this camera using: camera.inputs.add(new MyFancyNewFollowCameraKeyboardInput()); I can then write camera input controllers (in JavaScript) that would adjust the FollowCamera's radius, rotationOffset and heightOffset. If you like my camera input controllers for the FollowCamera I can share the code, so they might even become default. 🙂 Some background info: I use a FollowCamera in my BabylonJS Model Train Simulator game. It follows the train quite nicely, even in curves. 🙂 But when the train gets longer, I want the user to be able to adjust the radius to get the train in view again (zoom in/out). Also when the player operates the train at a station, I want the user to be able to adjust the rotationOffset to get a clear view on loading/unloading the train at that station. So it's kinda like an ArcRotate input but slightly different. Let me know how I can help achieve this or if there's a similar solution that achieves more or less the same. Thanks, Quintus
  2. I have read all of the camera inputs articles in the docs and I have tried to find a demo, but I can't seem to figure out how to add inputs to control objects other than the camera in Babylon. I have tried to manually add a keyboard event listener following Temechon's Infection code, but that doesn't work, as it interferes with camera input (either camera input will work or my inputs will work, but not both at the same time). Here is part of Temechon's code from https://github.com/Temechon/infection/blob/master/ts/Player.ts // Keyboard events this._handleKeyDownCall = this._handleKey.bind(this, 1); this._handleKeyUpCall = this._handleKey.bind(this, 0); window.addEventListener("keyup", this._handleKeyUpCall); window.addEventListener("keydown", this._handleKeyDownCall); Should I instead just implement my own ICameraInput and then put all of my game controls inside of this? It feels strange to have all game input inside of the camera. The controls don't control only the camera. But is this what Babylon experts usually do? It seems like this could create a problem when you switch from one camera to another. Is this meant to be done with the ActionsManager?
  3. Hello! Thank you for the new version of the Babylon.js. But i have a question with the VrCamera. On this version the mousse inputs don't work ? http://www.babylonjs-playground.com/#VVCUZ There is any solutions on this probleme ? Thank,
  4. I am trying to capture a FreeCamera's location and pan angle or rotation so I can reposition the camera later with the exact same view. (I am working with the playGround Collision example) I seem to be able to get camera.position.x, camera.position.y and camera.position.z ok but camera.cameraRotation.y just yields zero every time
  5. Hi, I'm trying to customize the camera inputs, but camera.inputs property is undefined. I am using the ArcRotateCamera, nothing custom. http://doc.babylonjs.com/tutorials/Customizing_Camera_Inputs Anyone had this issue before? Suggestions? Cheers
  6. Hey Everyone, I hope someone could help me with this, or if anyone has run into this issue before. I've noticed when I add a signal to an extended sprite, it will be executed immediately. Has anyone run into this issue before? var Card = function(game, x, y, data){ Phaser.Sprite.call(this, game, x, y, 'cardFront'); this.cardName = data.cardName || null; // String this.scale.setTo(0.15,0.15);};Card.prototype = Object.create(Phaser.Sprite.prototype);Card.prototype.constructor = Card;var card = new Card(this.game, 0, 0, {name:'test'});card.input.useHandCursor = true;card.events.onInputOver.add(highlightCard, this, 0, 'arg1', 'arg2');HighlightCard = function(sprite, pointer, arg1, arg2){ console.log('highlight:', sprite, pointer, arg1, arg2);}; Thank you!
  7. Hi all, I am trying to create a hex board game (see screenshot below) I am using sprites as the hexes. I'm reading the game board from a bunch of strings, and when I create the sprites, I created some custom properties on the sprites holding extra information like the array location, etc. var hex = game.add.sprite(hexX,hexY,'hex_base'); hex.arrayX = x; hex.arrayY = row; hex.counterNumber = counterNumber; hex.inputEnabled = true; hex.events.onInputDown.add(hexListener, this); I have been trying to assign an input event on the sprites so I can click on one and read those custom properties to access the array to do stuff, but the input event doesn't seem to be working at all. The "hexListener" handler doesn't seem to do anything at all. My complete code is below var game = new Phaser.Game(800, 480, Phaser.AUTO, '', { preload: preload, create: create, update: update }); var cursors = null; var HEX_WIDTH; var HEX_HEIGHT; var HEX_OFFSET_X; var HEX_OFFSET_Y; var boardArray; var boardWidth; var boardHeight; var boardColour = 0x2B2BFF; // blue board //var boardColour = 0xFF2E23; // red board var playerColours = [ 0x00FF00, // green 0xD51CFF // purple // 0x0000FF // blue ]; function preload() { game.load.image ('hex_base' , 'assets/hex_base.png'); game.load.image ('hex_left' , 'assets/hex_left'); game.load.image ('hex_right', 'assets/hex_right'); game.load.spritesheet('counter' , 'assets/counter.png'); } function isHex(hexChar) { if (hexChar == ".") return true; if (hexChar >= "0" && hexChar <= "9") return true; return false; } function getCounterAt(hexChar) { if (hexChar >= "0" && hexChar <= "9") return (hexChar.charCodeAt(0) - "0".charCodeAt(0)); return -1; } function loadBoard() { aWidth = arguments[0].length; aHeight = arguments.length; var ofsX = 10;//HEX_WIDTH;//(game.world.width / 2) - ((aWidth - 1) * HEX_OFFSET_X / 2) - HEX_WIDTH / 2; var ofsY = 10;//(game.world.height / 2) - ((aHeight - 1) * HEX_OFFSET_Y / 2) - HEX_HEIGHT / 2; boardArray = [aHeight,aWidth]; var hexY = ofsY; for (var row = 0; row < arguments.length; row++) { var boardRow = arguments[row]; var hexX = ofsX; for (var x = 0; x < boardRow.length; x++) { if (isHex(boardRow.charAt(x))) { var counterNumber = getCounterAt(boardRow.charAt(x)); var hex = game.add.sprite(hexX,hexY,'hex_base'); hex.arrayX = x; hex.arrayY = row; hex.counterNumber = counterNumber; hex.inputEnabled = true; hex.events.onInputDown.add(hexListener, this); hex.tint = boardColour; if (counterNumber >= 0 && counterNumber < playerColours.length) { // a counter is here so place that too var counter = game.add.sprite(hexX,hexY,'counter'); counter.tint = playerColours[counterNumber]; } } hexX += HEX_OFFSET_X; } hexY += HEX_OFFSET_Y; } } function create() { game.debug.enable; HEX_WIDTH = game.cache.getImage('hex_base').width; HEX_HEIGHT = game.cache.getImage('hex_base').height; var idealHexHeight = HEX_WIDTH / (Math.sqrt(3) * 0.5); HEX_OFFSET_X = HEX_WIDTH / 2; HEX_OFFSET_Y = HEX_HEIGHT * 40 / 56; var hexClickedText = game.add.text(0,0, "0,0", { font: "12px Arial", fill: "#ff0044", align: "left" }); cursors = game.input.keyboard.createCursorKeys(); loadBoard( ' . . . . . . . ', ' . . . . . . . . ', ' . . . . . . . . . ', ' . . . . . . . . . . ', ' . . . . . . . . . . . ', ' . . . . . 1 0 . . . . . ', '. . . . . 0 . 1 . . . . .', ' . . . . . 1 0 . . . . . ', ' . . . . . . . . . . . ', ' . . . . . . . . . . ', ' . . . . . . . . . ', ' . . . . . . . . ', ' . . . . . . . ' ); } function update() { } function hexListener(hex) { hexClickedText.text = "Hello world!!";//hex.x.toFixed + "," + hex.y.toFixed; } Any ideas? I'm stumped I've looked at the Phaser examples online and in the downloaded GIT repository, but I can't see what I'm doing wrong... cheers, Paul