Jump to content

velocityFromAngle cause inaccurate movement


dinoq
 Share

Recommended Posts

Hello, when I call velocityFromAngle this way:

scene.physics.velocityFromAngle(this.angle+this.imgAngle, this.speed, this.body.velocity);

It actually push my image in “inaccurate” way. As you can see in picture, on calling velocityFromAngle I create line, to see where my object shoult end. But it goes little bit out of line, so it end little bit up/down. Why?
If I exclude “this.body.velocity” from method calling, and instead I call this:

scene.physics.moveTo(this,this.x+vel.x,this.y+vel.y);
Everything works fine…Why is setting velocity in velocityFromAngle inaccurate (it gives me same result if I pass there this.body.acceleration).

Another strange thing is, that how much it goes out of line depends on passed speed. If it is 500, it gives results as shown in pictures. If it is 100, image ends only little bit above line. If it is 30, it ends in right position (on line).

Why?
Thanks!

start.png

end.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...