Victor Ks

2d projectile projection

Recommended Posts

1 hour ago, Victor Ks said:

I have made the calculations to find the position in 3D space but have a hard time with projecting in in 2D.

Can you link a drawing explaining this or a image of the game.

If it's for a 2D First Person Shooter then you just use the X and Y for location and scale the projectile using Z.

Share this post


Link to post
Share on other sites

Sure, it is top down and uses top down terrain but all the objects are rendered in isometric angle which gives an isometric illusion. I've tried isometric projection and it doesn't work though.  Is it possible to achieve this projection without my game being isometric? and what alternatives do I have maybe a tilt at x axis

projectile.thumb.png.175c64f1e86617bf25e

ARROW CURSOR.png

Share this post


Link to post
Share on other sites

Oh Fudge, do you need this to be real accurate or only visual appealing?

If you just want it visual appealing use the starting point(Archer) and end point(Target), then you can use a Curve to draw the path the arrow follows.

Brezier= (1-t)(1-t)*p0+2(1-t)t*p1+t*t*p2

use it on each axis like this:

BezInX = 10
BezInY = 50 //Play with these to get the right look

int BrezierX = (int) (  (1-t)*(1-t)*ArcherX+ 2*(1-t)*t* BezInX+t*t*TargetX);
int BrezierY = (int) (  (1-t)*(1-t)*ArcherY+ 2*(1-t)*t* BezInY+t*t*TargetY);

 

 

The two other ways I can think of doing this is to use a actual 3D coordinates with 2D art OR projecting. 3D is the way I would do it although that is only because it would allow me to use the above curve and leave projecting to the camera.

The problem with projecting is that the math gets very complex fast and you need to do all the calculations for the game on a separate grid and cast back and forth.

Here is a example of what I mean: http://clintbellanger.net/articles/isometric_math/

Share this post


Link to post
Share on other sites

Thanks for the help I've managed to project it to isometric and back and the result is good but now I have to account for the arrow rotation as well.

So how should I approach that?? I can find the 3D rotation along the 3 axes but can't figure out how to transform them to 2D.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now