Jump to content
  • Advertisement
Sign in to follow this  
EvilNando

radians to vector?

This topic is 2864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im trying to create a 2d vector to rotate my projectile

this is what Im doing

Vector2 aux = new Vector2((float)Math.Cos((double)radians), (float)Math.Sin((double)radians));

somehow it is not working as it should

any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Your code looks correct - that's generally how you would build a vector from an angle in 2-d.

Can you provide more details about the problem?

Share this post


Link to post
Share on other sites
yeah sure

thing is my engine for drawing needs radians to handle sprite rotations


but my projectiles I need vector2 to be able to apply velocities in a proper fashion

the problem is that I get my image flipped in every case

when shooting to the left, upwards and to the right

(to left shot may seem correct but if you look closely you will notice the shading of the projectile is at the top )



Uploaded with ImageShack.us

Share this post


Link to post
Share on other sites
for example when the angle is over 90 i get a radians value of 1.58 which is what I use to render the projectile

Share this post


Link to post
Share on other sites
found it

problem was that I was flipping my texture depending of the vehicle facing

which I solved by simple over-rotating the projectile accordingly

the problem of that is that I have to make sure to draw the projectiles with another point of light in mind (looks wrong when set to top-bottom , maybe something like front to back or omni directional light might work )

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!