Jump to content

Search the Community

Showing results for tags 'control'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 20 results

  1. Hi everyone! I want to set the current position to 0 in pixi.js video object. (video file extension is mp4. Loaded and played successfully) And stop the video completely (not pause). How can I do that? If you know about this, please kindly let me know. Thanks.
  2. So I'm running into this problem where I initialize a sprite with multiple animations, but only the animation specified in the creation of the sprite is ever played. When I attempt to update the sprite with a new animation, it simply changes the framerate. I have debugged the game to see if it is actually updating the currentAnim, and it is. Also, I have tested the other animations too see if they loaded correctly by inputting them into the initializing sprite animation. Now, code: player = this.game.add.sprite(400, 400, 'player_idle'); this.game.physics.p2.enable(player, false); player.body.fixedRotation = true; player.animations.add('player_idle'); player.animations.add('player_left'); player.animations.add('player_right'); controls.left.onDown.add(() => { console.log("Begin left: " + player.animations.currentAnim.name); player.animations.play('player_left', 14, true); console.log("End left: " + player.animations.currentAnim.name); }, this); controls.right.onDown.add(() => { console.log("Begin right: " + player.animations.currentAnim.name); player.animations.play('player_right', 14, true); console.log("End right: " + player.animations.currentAnim.name); }, this); update() { player.body.setZeroVelocity(); controls.up.isDown ? player.body.moveUp(200) : null controls.down.isDown ? player.body.moveDown(200) : null controls.left.isDown ? player.body.moveLeft(200) : null controls.right.isDown ? player.body.moveRight(200) : null if(!controls.left.isDown && !controls.right.isDown && !controls.up.isDown && !controls.down.isDown) { player.animations.play('player_idle', 3, true); } } I am using "[email protected]". I need some help. Thank you a bunch.
  3. Is there a way to control the distance or zooming of the reflected image. Check the two screen shots... Look at the mountains and scenery reflected in the larger sphere. The fist shot is from unity and it SHOW MORE of the reflected scenery behind... The second shot is my babylon but the reflected images are MUCH closer or ZOOMED in more so you see LESS of the reflected scenery in sphere... How can I control the ZOOM or reflected image distances ??? First Shot (Unity Rendered): Second Shot (Babylon Render) And Notice the difference in the ZOOM factor of the reflected scenery I need to ZOOM OUT a touch so it can match the WYSIWYG design time render of the unity scene NOTE: I luv how CRISP and CLEAN the baked shadows are... SWEET Yo @Deltakosh ... I am working on sending up the toolkit with documentation... Can you PLEASE start to work on that SHADER BUG/ISSUE where you cant have a ambient occlusion texture and a lightmapTexture (use as shadow map) at the same time... If people DONT KNOW that there is an issue and try to bake lights but wonder why they dont see the shadows... Most likely that scene (especially if you download from the asset store) will have ambient occlusion textures... So you won't see shadows in you scene. They show up in the sample screen shots I post in other thread because I went and REMOVED the ambient occlusion from the floor and walls. I will be uploading the first part of toolkit (The Scene Manager) and that Starting Documentation Stuff I told you about... Anyways, if you can do that so when folks get there hands on the toolkit, it will work
  4. Hiding and showing controls by using isVisible (like a Rectangle in this case) works if the control is not linked to a mesh by linkWithMesh. Once it is attached, the control stays visible. The inner controls (in my case the text inside the rectangle) can be hidden. See the playground https://www.babylonjs-playground.com/index.html#RBP60B#6 lines 35-42.
  5. In games agar.io and slither.io, player control is implemented with the mouse. The player is always in the center of the screen and moves in the direction the mouse cursor points to. Phaser.js offers us control only through the keyboard, as there https://phaser.io/examples/v2/camera/basic-follow. Perhaps someone already implemented control such as in agar.io and slither.io using phaser.js? Maybe someone has code samples?
  6. Hi all, I am using Universal Camera and I would like to improve differents features of it. This is the definition of my camera: var camera = new BABYLON.UniversalCamera("universalCamera", new BABYLON.Vector3(600, 200, -500), scene); camera.setTarget(new BABYLON.Vector3(0,0,0)); camera.speed = 1.5; camera.checkCollisions = true; camera.ellipsoid = new BABYLON.Vector3(1, 1, 1); camera.attachControl(canvas); The first question is about collisions. When I move arround the scene and I go to some building of, all the collisions are calculated and my camera is very slow. Are there any way to optimice this operation? When I am near of the different elements of my scene the movement of camera is very bad. The second question is relative to control of camera. I want change the arrow keys to "a","s","d" and "w". Do you know if is it possible? Thanks
  7. Hi, I have an animated ArcRotateCamera who's animation should pause quietly on user input (through PointersInput). At the moment the input components do not announce state changes. I think at the very least, input types should have a `get state` & an `on state change`. IMO the input system could use a rewrite.
  8. I'm trying to find a way to use the mousedown event to move the camera forward. I've mapped the keys so that T moves forward and want it to fire whenever there is a mousedown event. I have come up with the following but cannot get the keypress function to fire when there is a mousedown. Any suggestions would be most welcome. In the scene setup I've set the forward key to: camera.keysUp = [84]; // T After the scene setup I've added: document.addEventListener("mousedown", function(e) { var code = 84;//T $('document').trigger( jQuery.Event('keypress', { keyCode: code, which: code }) ); $("#show").append("mousedown creates: " + code + "<BR>"); }); document.addEventListener("keypress", function(e) { var key = e.which; $("#show").append("key code:+key+"<BR>"); //If it's the T key if (key == 84) { $("#show").append("T key has been pressed<BR>"); } }); // I would like the mousedown event to fire the keypress event // as if the T key has been pressed there is a div in the body to display the output: <div id="show"></div>
  9. So I'm not sure if this is a bug or maybe I've just not configured the camera correctly. I have a scene that's the interior of a building and the interior is made of a bunch of room meshes joined together. I have it so that when you click on a room the camera sets that room mesh as its target. If I try to pan the camera(ctrl and mouse drag) after clicking on a room the whole interior pans except for the room that I clicked on which stays in the centre of the screen, separated from the rest of the rooms. Any way to remedy this? I'm using an ArcRotateCamera by the way. Example of what I mean: http://www.babylonjs-playground.com/#18KHF6#0 Click on sphere2 and then pan the camera (ctrl and mouse drag).
  10. Hello I am trying to develop a FPS using BabylonJS and CannonJS in TypeScript. My first problem was what type of Impostor to use as the player, end up using a Cylinder with a FixedRotation = true. Now I place the camera on top off the Cylinder on every frame, and apply Impulses to the Cylinder based on keyboard input, and camera target. The algorithm that I came up is the flowing (hero = Cylinder): scene.registerBeforeRender(function () { //Your code here //Step camera.position.x = hero.position.x; camera.position.y = hero.position.y + 1.0; camera.position.z = hero.position.z; let camFront = camera.getFrontPosition(1.0); let vecFront = camFront.subtract(camera.position); vecFront.normalize(); let finalVector = new BABYLON.Vector3(0.0, 0.0, 0.0); if (moveForward) { finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecFront.x, 0.0, 1.0 * vecFront.z)); } if (moveBackward) { finalVector = finalVector.add(new BABYLON.Vector3(-1.0 * vecFront.x, 0.0, -1.0 * vecFront.z)); } if (moveRight) { let q = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(90)); let m = new BABYLON.Matrix(); q.toRotationMatrix(m); let vecRight = BABYLON.Vector3.TransformCoordinates(vecFront, m); vecRight.normalize(); finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecRight.x, 0.0, 1.0 * vecRight.z)); } if (moveLeft) { let q = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(-90)); let m = new BABYLON.Matrix(); q.toRotationMatrix(m); let vecLeft = BABYLON.Vector3.TransformCoordinates(vecFront, m); vecLeft.normalize(); finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecLeft.x, 0.0, 1.0 * vecLeft.z)); } finalVector = finalVector.normalize(); hero.physicsImpostor.applyImpulse(new BABYLON.Vector3(15.0 * finalVector.x, 0.0, 15.0 * finalVector.z), hero.getAbsolutePosition()); }); Is there a more effective way to do this ? Thanks in advance.
  11. How can i control the initilization of the game, i know that the first that phaser do is the preload function but i want to execute some Js code and till that part is finished start the game. Help please
  12. I'm making a top down game where the player moves smoothly around the plane but is confined to a 64x64 grid, I have achieved this by allowing them to move if they are exactly positioned on one of the 64x64 tiles and if they are, the game tweens them to the appropriate tile. The problem is that despite my best efforts it is still possible to move diagonally which would cause a lot of bugs in my collision code. This is the code I am using update: function () { if (player.x%64 === 0 && player.y%64 === 0) { if (game.input.keyboard.isDown(Phaser.KeyCode.W)) { game.add.tween(player).to({y: player.y-64}, 250, Phaser.Easing.Linear.None, true); } else if (game.input.keyboard.isDown(Phaser.KeyCode.S)) { game.add.tween(player).to({y: player.y+64}, 250, Phaser.Easing.Linear.None, true); } else if (game.input.keyboard.isDown(Phaser.KeyCode.A)) { game.add.tween(player).to({x: player.x-64}, 250, Phaser.Easing.Linear.None, true); } else if (game.input.keyboard.isDown(Phaser.KeyCode.D)) { game.add.tween(player).to({x: player.x+64}, 250, Phaser.Easing.Linear.None, true); } } }, Any help would be great! Thanks in advance
  13. Hi I am learning to write shaders and I have noticed that there are a lot of different view spaces and it is not always easy to differentiate and test the output without the ability to rotate the object. It gets more complicated when spaces have to be combined such as bump mapping + environment mapping. For example, in the cell shading demo I notice that the spot light appears to stick to the object and I would want to know if this was because I am orbiting the light source or if it would remain static when I rotated the object alone. Is it possible to rotate the object without orbiting the camera on the CYOS site? Could this feature be added if not? http://www.babylonjs.com/cyos/
  14. Hello. I can not understand the character configuration management. Character moves forward by means of "w" key. I along with "w" press and release "space". triggered event "keyup" and the event is "keydown" reset how to fix this problem? Make it so that the event "keydown" will not be reset?
  15. Can someone please explain/show me what code I need to insert to add mobile touch support to a game in phaser. I am trying to build onto the invaders example: http://examples.phaser.io/_site/view_full.html?d=games&f=invaders.js&t=invaders I need more specifically a button for keyboard left, a button for space bar, and a button for keyboard right on mobile. Also I have read the docs and I am fairly new to this, so I'm having a hard time deciphering what the docs are even talking about on pages like keyboard events, Phaser.key etc. If someone could please show me an actual example of how to do this, and not just tell me to read the docs it would be greatly appreciated.
  16. Hi there, I'm having a bit of a problem with camera controls and multiple scenes, I'm developping a web solution with multiple scenes (allowing me to lower memory and ressources usage and "removing" the dynamic light limit ). The only issue I'm having is that when switching from a scene to an other and locking the controls of the "old" scene with "old_scene.detachControl(renderCanvas, false);" the camera controls are still applied to the camera in the "old_scene". So, when I click and drag on the renderCanvas in a scene, the cameras in all scenes are rotating, even if the controls are supposed to be detached. I guess it's related to the way BabylonJS handles eventListeners... Any suggestion ? I can't really make a demo to show the issue for now, but I hope I was clear enough...
  17. When an unidentified specific sequence somehow the ship suddenly starts to climb up, but it should not be. The bug occurs when you click on the left side of the scene. Tell me, please, what is it? Link to the project. var clientX = 0; var clientY = 0; window.addEventListener("mousedown", function (e) { if (e.target.id == 'renderCanvas') { clientX = e.clientX; clientY = e.clientY; } }); window.addEventListener("mouseup", function (e) { if (e.target.id == 'renderCanvas' && Math.abs(clientX - e.clientX) < 10 && Math.abs(clientY - e.clientY) < 10) { var pickResult = scene.pick(scene.pointerX, scene.pointerY); if (pickResult.pickedPoint) { facePoint(newMeshes[0], pickResult.pickedPoint, scene, function () { moveObjectToPoint(newMeshes[0], pickResult.pickedPoint, scene); }); } } }); function facePoint(rotatingObject, pointToRotateTo, scene, callback) { var direction = pointToRotateTo.subtract(rotatingObject.position); var v1 = new BABYLON.Vector3(0,0,1); var v2 = direction; var angle = Math.acos(BABYLON.Vector3.Dot(v1, v2.normalize())); console.log(angle); if (direction.x < 0) angle = angle * -1; var rotationAnimation = new BABYLON.Animation("rotationAnimation", "rotation.y", 10, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT); var keys = [ { frame: 0, value: rotatingObject.rotation.y }, { frame: 10, value: angle } ]; rotationAnimation.setKeys(keys); rotatingObject.animations.push(rotationAnimation); scene.beginDirectAnimation(rotatingObject, [rotationAnimation], 0, 10, false, 1, function () { if (callback) { callback(); } }); } function moveObjectToPoint(objectToMove, pointToMoveTo, scene) { var moveAnimation = new BABYLON.Animation("moveAnimation", "position", 10, BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT); var keys = [ { frame: 0, value: objectToMove.position }, { frame: 30, value: pointToMoveTo } ]; moveAnimation.setKeys(keys); objectToMove.animations.push(moveAnimation); scene.beginDirectAnimation(objectToMove, [moveAnimation], 0, 30, false, 1); } });
  18. I have some code: ...var stage = new PIXI.Container();var texture = PIXI.Texture.fromVideo(url);var video = new PIXI.Sprite(texture);stage.addChild(video);...How I can stop the video or resume playing?
  19. Hey there, its me again with two stupid questions I looked for many examples on the web to understand how I can execute code when a key is pressed. Unfortunetaly, nothing worked for me. Is there a easy way to do this? I just need something like if(key.A) { variableNumber = 1; } Then I want to check some variables, so I tried to use the console from the debug layer: console.log(varTest); The console still tells me only that the Babylon.js engine launched. Any way to feed the console? Thanks for help!
  20. Hi everyone, I'm following a Phaser tutorial by @bryanbibat , the Shoot'em up game. The function moveTopoiter is good when play the game by mouse cursor. However, it hides my view on mobile touch screen. So that I want to improve the controlling of player on mobile touch by swipe action. I tryng to replace these lines in the update function: if (this.input.activePointer.isDown && this.physics.arcade.distanceToPointer(this.player) > 15) { this.physics.arcade.moveToPointer(this.player, this.player.speed); }with these if (this.input.activePointer.isDown ){ this.player.body.velocity.x = (this.input.activePointer.position.x - this.input.activePointer.positionDown.x) * 2; this.player.body.velocity.y = (this.input.activePointer.position.y - this.input.activePointer.positionDown.y); } else { this.player.body.velocity.x = 0; this.player.body.velocity.y = 0; }It works but the control isn't good. It isn'e sensitivre and jitter. I've just read these post but it doesn't help. http://www.html5gamedevs.com/topic/3862-swipe-to-jump/ http://www.html5gamedevs.com/topic/5449-directional-swipe/ Could anybody give me an advice?
  • Create New...