Jump to content

Search the Community

Showing results for tags 'accelerationfromrotation'.

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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 2 results

  1. Hey everyone, I am having an issue with accelerationFromRotation sending my player in the wrong direction. I'm setting it up so that the player will be spinning using angularVelocity and when you press space it moves in the direction that it's currently facing. To do that I'm using accelerationFromRotation to get a point then using moveToXY to push them in that direction. This definitely works some of the time, but most of the time it send the player in a seemingly random direction, so I think I'm missing something about how this is meant to work. Could someone enlighten me? Edit: I should add that I know moveToXY will try to move the whole way to the end of the point object which is beyond the screen, so I'm using drag to slow it down so that it is just a shove rather than a fling to the distance This is the function I'm using to move the player: function shunt() { playerRotate = false;//so we know the player isn't spinning while they move player.body.angularVelocity = 0; //actually stopping the spinning var goTo = game.physics.arcade.accelerationFromRotation(player.previousRotation, 300, player.body.acceleration);//to make the point to move towards game.time.events.add(Phaser.Timer.SECOND / 2, slooooow, this); //wait half a second then start rotation again game.physics.arcade.moveToXY(player, goTo.x, goTo.y, 600); //move the player towards the point function slooooow() { playerRotate = true; } }
  2. Forgive me if I don't use the correct terminology and also if this is solved elsewhere. I'm still new enough to this that I'm not quite sure what questions to ask and/or what to search for...With that said, if I haven't provided adequate information please let me know. I copied the asteroid movement for a game I'm working on but it doesn't seem to act that way you would expect. When I use accelerationFromRotation on the body of the sprite, if the sprite is point at an angle, it moves the sprite in an arc. I didn't notice this until I added a particle trail to the ship. When you're accelerating you can actually see the particle trail start to skew left or right. I've taken a screen shot to display the issue: This happens more extreme at some angles vs others. In some cases, the trail seems to be off by as much as 30 degrees. Also, what I have logged in the console is `body.acceleration`. This is the code for the acceleration, and rotation right out example and modified to reference my sprite: if (this.controls.u) { this.physics.arcade.accelerationFromRotation(this.player.rotation, 300, this.player.body.acceleration); } else { this.player.body.acceleration.set(0); } if (this.controls.l) { this.player.body.angularVelocity = -300; } else if (this.controls.r) { this.player.body.angularVelocity = 300; } else { this.player.body.angularVelocity = 0; } Just a little on the particle emitter to make sure I'm providing the necessary info: The gravity is set to zero and it has no velocity applied to it. It creates the particle and relies on the ship moving to create the trail to allow for visual deceleration.
×
×
  • Create New...