开发者

Rotating a ship 360*

开发者 https://www.devze.com 2023-03-22 17:06 出处:网络
In game Im trying to make, I have some ships(not space ships or so, actual ships they are in water) If I just directly rotate them, I get absurd results.

In game Im trying to make, I have some ships(not space ships or so, actual ships they are in water)

If I just directly rotate them, I get absurd results.

Do I need to make 8 picture for each ship ? (considerin开发者_运维问答g there is 8 direction) Are there any way that I can do it with just creating one image or at least a few, instead of 8 ?


Essentially, rotation mathematics are an interpretation of the original image.

Sure, it works depending on the complexity of the image and the relationship of straightlines and things that are perpendicular, but some things just dont work.

If you're doing a top-down 2D game with ships, I'm going to assume Sail ships here, then rotating mathematically really just isn't going to look good as the sails them selves will move and angle depending on Wind speed/direction and the angle of the ship.

Long story short ? Mathematical rotation works well for an Asteroids style triangle ship, doesn't work well for proper graphics.

Hope this helps!


If you are talking 2D graphics and are getting "absurd results" I'm assuming you're not taking into account an origin. If you have a Texture2D and give it a rotation value, it will be rotating by the default origin which is (0,0). Try setting your origin in your spritebatch.Draw call to a new Vector2(texture.width / 2, texture.height / 2) and see if that is a step in the right direction.

Another approach would be to have a spritesheet with the 8 drawings that you mention and reference a different source rectangle of the texture2D.

0

精彩评论

暂无评论...
验证码 换一张
取 消