Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by wands

If this is happening, what is the correct way to offset the position of the bullet when spawning the bullet entity?

Can anyone show an example?

1 decade ago by wands

I forgot to mentioned that my player rotates and shoots. The translation doesn't seem to fit correctly when it's rotated at a different angle.

If only I could get the same result as X-type.

1 decade ago by Joncom

Check out this Wikipedia article on rotation matrices.
Specifically, I think you're looking for this:

newX = oldX * Math.cos(angle) - oldY * Math.sin(angle);
newY = oldX * Math.sin(angle) + oldY * Math.cos(angle);

1 decade ago by wands

Thanks for the reply. I found an old thread which Dominic replied. This is what I'm looking for.

http://impactjs.com/forums/help/position-bullets-with-rotating-spaceship/page/1
Page 1 of 1
« first « previous next › last »