- Home /
Shoot mortar on clicked floor
I have a game where the player controls a car and it has a mortar like weapon which is static on the car. I need to be able to click and fire the mortar on to the spot i click it on. I do not need real physics just the illusion of it as I want to minimise calculations on he CPU. All I need is to have the projectile go up in an arc and come down where I clicked.
Is there a formula or something I can try to achieve this?
I am able to obtain the vector position of where i clicked. I need to present my projectile such that it looks like it's being shot into the air and back down to that position.
I have the vector that player is at, vector of clicked area and distance between the two but I don't know how to put those into working calculations to shoot the mortar from.
Answer by save · Mar 29, 2012 at 07:37 AM
This isn't all that easy as there are a couple of factors you would have to consider in a formula like that. Have a look at iTween (Accurate lob), this does exactly what you want to do.
I know about iTween and yes that it my desired effect but I want to achieve this by using vector equations. I have my Player's vector position, my clicked vector position, the direction vector and I'm thinking of having the angle at a static 45 degrees so now I would need to automatically adjust the power according to the distance between the two. Is this possible? and what vector equations can I use?