Search the Community
Showing results for tags 'move'.
-
Hello evryone, i try to better understand collisions & mehs interactions. I found this demo on the babylon.js 101 docs: http://www.babylon.actifgames.com/moveCharacter/ https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity Is it possible to get the source code ?
-
Hello, i am again... i have a realy noob question but cant find an answer. Since i playing with this Playground i try to figure out how i can get the position of the car (mesh = carBody ?) Im not successful. Line 42 - 44 scene.registerBeforeRender(function(){ console.log("Poisition", carBody.position); }); The only thing that changes is when i turning the steering wheel. Nothing about the position on the ground... I tought the carBody "merge" all meshes into one and move them around with them. So that the positions property on child meshes a relative to the parent mesh. I dont get it...
-
Hello , It's my first post in the forum. I need your help. When i click in a mesh , i need the camera get in front of the Mesh. Thanks for your answers.
-
So I have the following code to draw my UI. var ui = { menuBar: null, drawMenuBar: function() { var bar = new Phaser.Graphics(game, 0, 0); bar.beginFill(0xFF0000); bar.drawRect(0, 0, 600, 40); this.menuBar = game.add.sprite((window.innerWidth/2) - (bar.width/2), 0, bar.generateTexture()); this.menuBar.fixedToCamera = true; }, updateMenuBar: function() { this.menuBar.fixedToCamera = false; this.menuBar.x = ((window.innerWidth/2) - (this.menuBar.width/2)); this.menuBar.fixedToCamera = true; }, updateUi: function() { this.updateMenuBar(); } }; As you can see, to move the sprite in updateMenuBar I have to set fixedToCamera to false first, and then back to true. Is there a more elegant way to do this? If I just try to set menuBar.x to something, it wont move. The above code solves my problem, I just thought it would be interesting to see if anyone else has a better solution (as Google has yielded me no satisfying answers) :). Cheers!
-
Hello. Sorry in advance for my bad english language. I am new in babylon.js and I tried some things and i relly like it.Now I want to make RPG game when player will be move forward with "w" and will go to mouse pointer direction but I can´t to figure out. Always redBox (player) wierdly go in to opposite duraction and in a case of collision i don't have any idea how it works here si my project : http://www.babylonjs-playground.com/#3F5YVW#2 I will be so glad if you can show me way how to reach a results .
-
Hello. Sorry in advance for my bad english language. I am new in babylon.js and I tried some things and i relly like it.Now I want to make RPG game when player will be move forward with "w" and will go to mouse pointer direction but I can´t to figure out. Always redBox (player) wierdly go in to opposite duraction and in a case of collision i don't have any idea how it works here si my project : http://www.babylonjs-playground.com/#3F5YVW#2 I tried everything what i found on forum. I will be so glad if you can show me way how to reach a results .
-
Hello! How can I the movement of the camera over the map, as with wildsavagekingdom? Look http://www.wildsavagekingdom.com Someone a Playground Example ? Thanks.
-
Hi there, Hi have a sprite moving on the x axis at a given speed. When the user press on the space bar, I want (1) the sprite to stop on y axis, (2) make a move to the right, (3) go back at his initial position, and (4) continue his way on y. I've tried with the following code but the sprite stops while going back to his position and keeps shaking. Is there an easier way to do what I'm trying to achieve? If not, how could I debug this code? Many thanks! PS: my sprite will have to consider collisions. if (this.space.isDown){ let position_man = this.man.body.y; let speed_man = this.man.body.velocity.y; this.man.body.velocity.y = 0; let tween = game.add.tween(this.man); tween.to({x:200},100,"Quart.easeOut"); tween.start(); tween.onComplete.addOnce(retour,this); function retour(){ let tween2 = game.add.tween(this.man); tween2.to({x:100},100,"Quart.easeOut"); tween2.start(); } this.man.body.velocity.y = speed_man;
-
Hi all! How to move to the point of clicks at p2js? this.game.input.onDown.add(this.onClick, this); In the event handler I have "pointer.position". What's next? I did not find a single example. I found a similar question here, but there is no answer to it. http://stackoverflow.com/questions/36120249/precision-moving-a-body-using-phaser-and-p2-js-physics
-
Hi i want to make those little circles move to a certain random point and watch them moving how is it possible to do it ? here http://asciimulation.link/creatures/new project/ thx in advance
-
So I have a multiplayer game set up, I had originally coded it so when the player clicks on an X,Y coordinate the server would move the player towards that coordinate on every update. I decided this would be too laggy if the server was under load and opted to use tweening instead. I have one issue though... when I click on a coordinate I have the player sprite tween and play an animation but if I click somewhere far away then it speeds up the animation and the sprite gets there quicker? example: I click 20px away from the player and it plays the whole animation and gets there in the correct amount of time I click 300px away and it speeds through the animation and really quickly moves to the coordinate is there any way to stop this? I tired to use game.tweens.frameBased but that has not worked? I also removed physics but that didn't help either
-
Hello, I've got this issue and I'm not able to find any answers. I have 2 images - background and a soft edged circle for a mask. Background stays in same place, but the circle should be able to move. As far as I understand I can send mask coordinates when using alphaMask(source, mask, sourceRect, maskRect) by sending maskRect settings, but if I create rectangle (var rect2 = new Phaser.Rectangle(200, 200, 300, 300);) before applying alphaMask, the mask doesn't work. How can I send maskRect options? Or I should approach this somehow differently? Current code I have: var bmd = game.make.bitmapData(2141, 800); bmd.alphaMask('BG_Dark', 'Mask'); game.add.image(0, 0, bmd); Now it simply places both the BG and Mask at 0,0. But I need the mask to be, for example, at 300,300;
-
Hi there, I'm having a problem getting a playground sample to work on my xampp localhost, I got the Zip file of the Collisions example from the playground (http://www.babylonjs-playground.com/# -9 Collisions), the freecamera works perfectly when I run the online example, but when I test it on the localhost, the camera won't move at all, it will rotate with the mouse, but will not respond to my arrow key presses. Can someone explain why does the example works online and not on local ? Update: When tested using Internet Explorer, it works, but does not work using Firefox or Opera. So is there a difference between IE and other browsers conserning handling local html files ?
-
Scenario: I want to move a mesh along the z axis. Option 1: set up a Babylon Animation using keys etc to move the mesh to desired position Option 2: update the meshes position.z (+1 or -1) in the render loop until the desired position Question: Which of these options would be the most CPU intensive? Is there something special about Babylon Animations that make them worth using over option 2? Thanks
- 1 reply
-
- animations
- mesh
-
(and 2 more)
Tagged with:
-
Hello guys, I got an issue when I want to implement a drawing tool, if I move the pointer slow, it can draw a linear line, but if I move the point fast, it will have the gap between my 'brush' dot. I have attached a screenshot for this issue. My planning solution is: when the pointer isDown or is dragging, start drawing. However, it seems there are not 'dragging' or 'moving' method for input.pointer. Is there any other ways that can solve this problem? Thank you very much.
-
Hi guys, Help me please to improve my plugin! Codepen: http://codepen.io/jdnichollsc/pen/OVZPwx GitHub: http://jdnichollsc.github.io/Phaser-Kinetic-Scrolling-Plugin/ See the error: http://screencast.com/t/4iP2kPNJ ( "if i scroll once in the canvas, then click anywhere outside, the canvas also scroll randomly" - Wagyl ) Thanks in advance and Merry Christmas! Nicholls
-
Does Phaser have support for making a scrollable list, as in, one that you can scroll with the mouse wheel, and not just by dragging it? If it doesn't, is there any way I can implement it? Thanks! =)
-
Hello everyone !!!! I got the Xbox controller to work on my game but I cant make the RT button work. Is there any way to do that?
-
Greetings, I recently started working in Phaser and it seems like a pretty good framework, for practice I started working on simple top down shooter game and now it seems I have a problem with move toward the object functionality (enemies moving toward player), I have tried few solutions including all from this post: http://www.html5gamedevs.com/topic/3441-movetoobject-help/ but I was unable to make it work, I'm complete noob and probably doing something wrong but I cant figure out what, so I hope some you guys can help me out, thanks in advance. Here is the part of code I have done so far: function create() { game.world.width = 800; game.world.width = 600; game.physics.startSystem(Phaser.Physics.ARCADE); bullets = game.add.group(); bullets.enableBody = true; bullets.physicsBodyType = Phaser.Physics.ARCADE; bullets.createMultiple(50, 'bullet'); bullets.setAll('checkWorldBounds', true); bullets.setAll('outOfBoundsKill', true); player = game.add.sprite(400, 300, 'arrow'); player.anchor.set(0.5, 0.5); game.physics.enable(player, Phaser.Physics.ARCADE); player.body.allowRotation = false; enemies = game.add.group(); enemies.enableBody = true; createEnemies();} function createEnemies () { for (var y = 0; y < 2; y++) { for (var x = 0; x < 5; x++) { var enemy = enemies.create(game.world.randomX, game.world.randomY, 'enemy'); enemy.anchor.setTo(0.5, 0.5); enemy.body.moves = false; } }} function update() { player.rotation = game.physics.arcade.angleToPointer(player); if (game.input.activePointer.isDown) { fire(); } game.physics.arcade.overlap(bullets, enemies, collisionHandler, null, this);}
-
Hi, i've a quick question. Is it possible to move a group of sprites in a smooth way. Velocity of 300, for moving from right to left. Every few seconds i've created a group of sprites from 16 - 128. But in movement i can see a jittering. Tested on Chrome and Cocconjs. I've tried a lot of different thinks. - Not velocity. X and y of the sprite directly in the update function - this.game.renderer.renderSession.roundPixels = true; - create one sprite with arcade physic and all other only as childs. - Super small image May be someone has an idea to move sprites in a smoother way. In the game jetpack joyride, there are also groups of a lot of sprites (coins)..... Regards, Chris
-
Hello Im doing the game like arkanoid. The problem is when I try to move the bar with physics. When the bar has collided with the wall it lose the path and don't move straight to left to right. When I also try with moveWithCollisions() it works bad when the bar collide with the ball. How can I resolve this?
-
Hi all, In my game I want to have a 2d array of sprites move down the screen (starting in -y territory / not visible). I have built a version of the game that works but I fear I am wasting a lot of resources and making the game run less smooth than it should. I would appreciate some advice on how to create my group(s) and sprites so that I maximize resource management. This diagram explains my question: I am fairly experienced with JavaScript and am looking mostly for advice (although code helps too!). Should this be one group? Should it be a group of groups (where each group is a row)? Should I simply use sprites for the entire thing? Thank you!, Joey
-
I tried to make a simple FPS on the "height map". I put an example http://www.babylonjs-playground.com/?14# freeCamera and set her property: camera.checkCollisions = true;then begin terrible brakes. Everything starts to work very slowly. Is it possible as it is optimized? Example:ws http://www.babylonjs-playground.com/#QHWP
- 1 reply
-
- FreeCamera
- Babylon.js
-
(and 3 more)
Tagged with:
-
Hi, I develop a game which uses P2 and collisions. But in the latest versions, the behavior of move, speed and collision are very different. My reference example is “World move” between Phaser 2.0.6 and the lastest version. http://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=world+move.js&t=world%20move I think the move behavior is more realistic in Phaser 2.0.6. So, how to keep these behaviors with the last version? I have made live examples with jsbin, to see the differences : Test 1: moveforward 3000 + angle 90 The ball bounces many times, and the speed gradually slows Phaser 2.0.6: http://jsbin.com/moxijibebuta/1/edit?html,js,output The ball bounces one time and nothing… Phaser 2.1.2: http://jsbin.com/kipayexoqadu/8/edit?html,js,output Test 2: moveforward 1000 + angle 60 The ball bounce many times, and the direction is fine for each bounce. Phaser 2.0.6: http://jsbin.com/wiloyizanucu/1/edit?html,js,output Indescribable… Phaser 2.1.2: http://jsbin.com/rejidageguhu/1/edit?html,js,output What do you think about that? Can we have the movement from 2.0.6 with the latest version?
-
Hi, currently, i've problems to move the ArcRotateCamera correctly around. I came up with this code: translation = BABYLON.Vector3.TransformNormal(translation, this._camera.getWorldMatrix());translation.y = 0;this._camera.target.addInPlace(translation);but the translation in z direction is slower, since the camera is tilted (i need to set translation.y to zero after transformation). Is there a good way to just rotate my desired translation around the y-axis in dependent to the alpha of the ArcRotateCamera? Kind Regards, Chris
- 5 replies
-
- ARcRotateCamera
- Move
-
(and 1 more)
Tagged with: