alexandernst

Members
  • Content Count

    25
  • Joined

  • Last visited

About alexandernst

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. How can I set the direction at which an object should be moving at in MatterJS physics? In Arcade physics I'd do `this.scene.physics.velocityFromRotation(angle, this.speed, this.velocity);`, but MatterJS doesn't seem to have a `velocityFromRotation` method.
  2. @PixelPicoSean I already did that when I replied to you and I described the problem that I'm getting with that origin. Please reread my reply.
  3. @samme No. I want the bullets to get rendered from the left/middle, not from the middle/middle.
  4. @PixelPicoSean Setting origin to (0, 0,5) (left center) doesn't solve the issue entirely. Now the text is aligned with the physics body when shooting left or right, but not up or down. Also, shooting to the right will still leave a small margin, and shooting to the left will leave that same margin, but negative. Demo: http://plnkr.co/edit/icXSBM7HnqWmud9iG11l?p=preview
  5. I have a "Gun" object and a "Bullet" object, and I'm trying to adjust the offset at which the bullet should start from the gun, but I'm getting an unexpected margin which I can't find where it's getting from. This extra margin/distance happens when I fire the gun to the right or down, but it converts into a negative margin/distance when I shoot to the left or up. The second problem is that the text "pium pium" get's horizontally/vertically out of it's body depending of the angle. Here is a demo of the problem: http://plnkr.co/edit/dOLK0j1qOEphv2nLLJKE?p=preview
  6. Answering to my own question: rotation physics bodies is not possible with arcade physics. For this to be possible I'd need to switch to matter.js physics.
  7. Okey, I got it working with `Phaser.GameObjects.Text` and `physics.world.enable` as you said. But now I have another problem. I'm trying to rotate the text and the physics body that is attached to it, but only the text itself is rotating. Demo: http://plnkr.co/edit/G7obzt6xtwKJtYcv5oay?p=preview
  8. Is there a way to create a text object with physics on it, the same way I'm able to create an image object, like this: Phaser.Physics.Arcade.Image.call(this, scene, 0, 0, "my_image"); If there isn't a direct way of creating such thing, what would be a good alternative of having a dynamically generated text that acts like a game object with physics?
  9. Answering to my own question: http://plnkr.co/edit/nBoIiwjEA5M93OUawayX?p=preview this.input.on("pointermove", function(pointer) { var angle = Math.atan2(pointer.y - this.gun.y, pointer.x - this.gun.x) * 180 / Math.PI; this.gun.angle = angle; }, this);
  10. Great! Everything looks like it would have been very easy to figure out, only if there were some books/docs on Phaser 3... Anyway, my next question: how can I make my gun always face the pointer? I saw this demo ( http://labs.phaser.io/edit.html?src=src\input\mouse\pointer lock 3d rotate.js ), so I already know how to detect when the pointer is moving, and I know how to get the (x,y) vector of the pointer, but I don't know how to translate that position to the required angle.
  11. @PixelPicoSean I have another problem with the position of the bullets. http://plnkr.co/edit/wEsq9eFKaQKAL0wyPQTB?p=preview Note that I have set the initial position to be `x + 40`. If I fire the gun right after launching the game, the position of the bullets is correct, but when I rotate the gun, the bullets don't rotate using the gun's "orbit". <-- this is correct <--- this is incorrect How can I "orbit" rotate the bullets?
  12. Yuhuuuu!!! It's working \o/ Nice! Thank you!
  13. There doesn't seem to be such a method (I'm inspecting all the methods with Chrome's debugger). Are you sure this is correct?