Jump to content

Search the Community

Showing results for tags 'angle'.

  • 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
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • 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

  1. Hello! I'm trying to make a game like raze (flash game from 2010~ish) and I currently have a level import system and moving animated sprite. I am using matter.js for the physics. I am also using phaser 3 v3.12 as tiled hit detection(? idk how to say) breaks in the the newer versions. I saw the demo for angle to pointer (http://phaser.io/examples/v2/arcade-physics/angle-to-pointer#gv) and wondered if something like it existed in Phaser 3. and also, it would be great if i could anchor a sprite onto another moving one (the weapon on the player) as then it would work, but idk how t
  2. I have done a demo code that creates a gun (blue box) and bullets (red boxes). How can I set the initial position of the bullets depending of the rotation of the gun? Said with other words, if I rotate the gun (left/right arrows) , the bullets keep coming from the top side of the gun (box) instead of rotating accordingly. Code: http://plnkr.co/edit/3evg6J2cGo0nS7QKxiak?p=preview Preview: http://run.plnkr.co/AodG3n4Ykb3osdh2/
  3. Hi, I'm creating a game that player can walk over terrains with lots of slopes. How can I make my player rotate accordingly to the angle of the slope? This is how it's currently working: And this is how is must work (I've changed the angle manually): I'm using Box2D plugin to generate the terrain accordingly to an image. That's the reason of all these bodies. Thanks!!
  4. I am setting up some camera rotation things and I want to know how to lock the camera rotation, so when I move the mouse on the y axis (the camera is pointing at the mouse btw) it is locked to stay looking at part of the screen that for examples sake is above 30% from bottom and below 70% of the scene? Also i want to know if i can set up a mouse hover for movement the pseudo code would follow; -detect mouse position -if position is under 40% from left to middle rotate camera left, if position is between 40-60% rotation left at a slower speed if position is greater than
  5. Hi everyone! I have actually a problem which is quite stupid but I really need help to solve it: I have a sphere (position 0,0,0) on which I want to "put" a mesh. I have a ray coming from the center on the sphere to a point somewhere in space, and want to put the mesh on the sphere surface, oriented to the center of the sphere, as if the sphere was a planet. I don't find anything in order to rotate a mesh from a ray in Babylon, and all the tries I do with a trigonometric approach aren't satisfying… Here is the code doing that: http://www.babylonjs-playground.com/#C1M3C7 T
  6. I have an issue where I am using the followCamera in a top down view (think original grand theft auto). It works fine except when I apply impulse to my character/mesh/imposter to where the character moves backwards, the camera rotates a full 180 degrees. I want the camera to stay in the position so that it never rotates. Meaning, the north portion of the map will always be north, regardless of the direction of the character/mesh/imposter the camera is following in the top down view.
  7. Hello fellow HTML5 Game Devs. I have an interesting problem I am testing out some controls and different schemes for my game. I have an image of a fighter. It uses the arcade physics mode. When I press the UP arrow, it goes right.... Code: var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.image('background','../assets/images/deep-space.jpg'); game.load.image('fighter','../assets/images/Human-Fighter.png'); } var player; function create() { gam
  8. Hello, I am building an Oceanic game and need to utilize the water surface. I am swimming fish through the sea however at angle '0' I want to fish to be pointing up and not left. I do this by creating the angle 90 degrees: this.xSpeed = Math.cos((this.fishBody.angle+90)/180*Math.PI) * -this.pSpeed; this.ySpeed = Math.sin((this.fishBody.angle+90)/180*Math.PI) * - this.pSpeed; However, I run into problems down the road with AI Fish.prototype.avoid = function(fishBodx, FishBodY, xsp,ysp){ var targetAngle = this.game.math.angleBetween( xsp, ysp, fishBodx, Fish
  9. Hello guys, I am using the sprite for a shot from a gun effect. How I can rotate Y axis of a sprite? I need somthing like on screenshot. My sprite: It screen I did in the photoshop to give an opportunity to understand what I need
  10. I´m having a problem with the weapon plugin. When I use the function weapon.fire() it fires a bullet 90 degrees from the canon sprite (the one the weapon plugin is tracking). Any idea what I am doing Wrong? Thnxs!
  11. Hi everyone, I have an animated sprite of a meteorite with it's tail. I need that the collisions are only for the rock and to be able to rotate the sprite with the movement direction. If I setup the body size like this: this.anchor.set(.55, .55); this.body.setSize(110, 110, 400, 350); The graphic and body collision is fine if the angle of rotation is 0. But I need to rotate the sprite around the anchor point and then the body is not on the desired position of the sprite. How can I fix this?
  12. I am back with another crazy thingy! I have here for your pleasure, a playground! http://www.babylonjs-playground.com/#28AM9V#1 I have some notes at the top of the playground but let me break this shiz down for you. I am trying to modify the arcRotateCamera's beta based on mouse wheel scroll. I have this sort of working.. well, it does work... BUT, I am having trouble with it; it's choppy and just not right. I'm trying to get it smooth like butter (have easing). The idea is the closer you get to the target, the beta changes so you go from a top(ish) view to more of a 45-40 degree ang
  13. I'm trying to make a 2d space game involving a sort of space dogfight between the player and some ai bots. I need help with the enemy ship automatically rotating towards the player, but not being exactly pointed towards the ship 24/7. I want the enemy ship to have some "lag" in its response to the player's movement so it's more realistic. Right now I have a model which is not realistic and would probably be too hard for the player to win: update: function(){ //blah blah var tempAngle = Math.atan2(fightSprites.player.y-fightSprites.enemy[i].y, fightSprites.player.x - fig
  14. I have a demo at http://www.babylonjs-playground.com/#1JMZWJ#11 What I am try to do is create a cylinder between two points, but it seems calculation for y-axis doesn't work. in the demo I move the target in all three directions (x,y,z) and I can clearly see the cylinder doesn't connect two points, but if I comment away the movement of y axis, the angle seems to be correct, I am really puzzled, can anyone help me? I am new at 3d programming and new at BabylonJS
  15. Hi Guys, So I'm flying a space ship using the accelerometer and gyro.js, with gyro.js I calculate the angle the ship is flying in. Now I want to fire a laser when I touch my mobile device's screen. The laser should fire in the direction the ship is flying in, no matter where the user touches the screen. I've searched for a couple of hours, but still didn't find a way to make this work. Any ideas? function fire(angle) { if(game.time.now > bulletTime) { bullet = bullets.getFirstExists(false); if(bullet) { bullet.reset(player.x, player.y + 8); bullet.rotation = this.game.physic
  16. Hello, I'm having an issue with setScaleMinMax property on sprites, I have two sprites, parent and child, the child is set to a min/max scale of .5 and the parent is scaling freely, I'm having odd results when scaling the parent. The parent also rotates, in some angles the child maintains the scale but in others it scales, what can I do to prevent the child from scaling? Thanks.
  17. Hello, I saw a post about limiting camera zoom and direction. However, I want to limit camera to a "top-down" only view. Zoom in and out is acceptable. Probably leave that alone. But I want to restrict the ability to rotate the view. Is it doable? If so how? Thank you...
  18. Hi everyone! I don't really know where I should post this, thus I post it here. Maybe it's inappropriate, so please tell me where its rightful place may be. I've come across some kind of a bug (maybe intended) and I'd like to suggest a fix. In the arcade engine, the angleBetween() method uses the x / y coordinates of the targeted sprites, and I think it should use the world.x / world.y coordinates instead. In my use-case, I had a character with a child sprite, its gun, that I wanted to point to the player. Because the gun was a child sprite, the angle was not correct and the gun woul
  19. Hey guys! thanks for all the answers in the other topic, those helped me a lot ;). I have a doubt, how can I set a min angle and max angle for my camera rotation? because I don't want my camera to rotate 360° . What I tried is to let a little box to follow the camera and it has a collision with some walls in order to stop showing the part I don't want to. it worked but the effects are really ugly. That's is solution, as I mentioned It's has some ugly effects and is not always exact. var prevTarget= jQuery.extend(true, {}, camera.getTarget()); //OP1 scene.registerBeforeRen
  20. When I change a sprite it's rotation with *.rotation, *.angle or *.pivot, it also changes the position because the center of the sprite will change. I'm making a game with a grid and it makes my sprites fall out of their tiles, how can I prevent this? Also here are some example pictures: Normal http://i.imgur.com/V8FRJ3M.png Anchor 0.5 http://i.imgur.com/xLoEpZi.png Angle 90 http://i.imgur.com/x1YtRnn.png
  21. I'm trying to create a simple game involving a fish following the pointer by replicating and modifying this code: http://gamemechanicexplorer.com/#homingmissiles-1 (BTW great site for noobs.), but the entire missile/fish rotates towards the pointer in this example, while I don't want the sprite to rotate. How can I achieve this? Also how can I add animation to the missile while it is chasing and while it is turning by 180 degrees? Any help is appreciated.
  22. Hello ! Why does the start angle of an arc is acting weird when it is set to anticlockwise ? You can see it in this example : http://phaser.io/examples/v2/display/arc-details The start angle is moving... In fact, i'm trying to make a piechart so i need it to start in the right place.
  23. I need to rotate a sprite, according to the pointer. Phaser has the following code to do this. angleToPointer: function (displayObject, pointer) { pointer = pointer || this.game.input.activePointer; var dx = pointer.worldX - displayObject.x; var dy = pointer.worldY - displayObject.y; return Math.atan2(dy, dx);}Given this code, and reviewing the Class Vector in panda.js 2.0. In documentacionhe it is seen that has two methods which are: angle and angleFromOrigin. angleFromOrigin: function(vector) { return Math.atan2(vector.y, vector.x) - Math.atan2(this.y, t
  24. Hi, yesterday i was struggling with rotation of an enemy. In my game you drive a spaceship and the enemies should rotate to your location in the nearest way (left or right), so they can follow you. This seems to be simple, but i find some problems in the rotation degrees. First i have to find the angle that the enemy should have, to point to my spaceship. I find two ways to do it. The first doesn't work: angle = game.physics.arcade.angleBetween( this , player ); // returns angles between something like 3.1 and -3.1// ( this = Enemy class )I don't know why. Maybe because i am using p2 physics
  25. Is it possible to change the default 0 point of a sprite's rotation? So when a sprite rotates to say 135*, 135* becomes the new 0 point? Help is greatly appreciated!
×
×
  • Create New...