How can I calculate the force vector for a mortar in a computer game?

In summary, the game's mortar needs to be able to hit a target height of x meters and a target distance of y meters. The game's user needs to estimate the force vector needed for the mortar to hit the target height and target distance.
  • #1
s w
4
0
I'm in the process of created a computer game and I want to introduce a mortar into the game. What I want to do is given the initial position, target position, and target height, calculate the force vector that is needed to launch the mortar so it hits the target height and target distance. The reason I put a target height in there is so the mortar is doing an appropriate parabolic arc. I don't want it to just do a slight arc and hit the target, I want it to go relatively high but still remain inside the bounds of the level.

So to summarize. I know the initial position, target position, target height, mass of the object, and gravity (assume no drag) and I want to know the force vector needed. It also must be said that the initial and target positions lie in all 3 planes. So I'd really like to be able to hit a target that is higher or lower than the initial position if possible. As for the target height, that is the height above the initial position.
 
Physics news on Phys.org
  • #2
it depends if you have the resisting force of air and in what magnitude?F=kmv or F=kmv.v or ... and this depends on your estimated speed, without resistance: X=V*COSa*t,Y=(V*SINa*t)-((1/2)*g*t.t)
 
  • #3
Quoted from above.
s w said:
(assume no drag)
 
  • #4
i don't study physics in english so i am not familiar with some words but anyway just use the equations i mentioned in three dimension(x,y,z) and simply use F=ma thing on them, plus ,if you want to calculate the resistance first check your estimated speed with some table to see if the resistance is kmv or kmv.v and also you can estimate it by using the taylors formula or somethinh(f(X)=a1+a2x+a3xx+a4xxx+...) then cut off from xx.
 
  • #5


Thank you for reaching out to us for assistance with your computer game. To calculate the trajectory of a mortar, we can use the following equation:

y = y0 + v0y*t - 0.5*g*t^2

Where:
y is the vertical position of the mortar at any given time t
y0 is the initial vertical position of the mortar
v0y is the initial vertical velocity of the mortar
g is the acceleration due to gravity (9.8 m/s^2)
t is the time elapsed since the mortar was launched

To ensure that the mortar hits the target height and distance, we can set up a system of equations using the above equation and the given information. This will allow us to solve for the initial vertical velocity (v0y) and the time of flight (t) needed to hit the target.

To calculate the force vector needed, we can use Newton's second law:

F = m*a

Where:
F is the force vector needed
m is the mass of the mortar
a is the acceleration of the mortar, which can be calculated using the initial vertical velocity (v0y) and the time of flight (t) obtained from the previous equations.

We can also take into account the target height by adjusting the initial vertical position (y0) in the trajectory equation.

Please note that this is a simplified approach and may not take into account other factors such as air resistance. Depending on the level of accuracy needed for your game, you may need to incorporate more complex equations and variables.

I hope this information helps in creating a realistic and enjoyable experience for your players. Good luck with your game!
 

FAQ: How can I calculate the force vector for a mortar in a computer game?

What is a trajectory equation?

A trajectory equation is a mathematical expression that describes the path of an object in motion. It takes into account factors such as velocity, acceleration, and the effects of gravity to predict the position of an object at any given time.

Why is it important to have a trajectory equation?

A trajectory equation is important because it allows us to predict the motion of objects in a variety of scenarios. This can be useful in fields such as physics, engineering, and astronomy, where understanding the path of an object is crucial for making accurate calculations and predictions.

How is a trajectory equation derived?

A trajectory equation is typically derived using principles of classical mechanics, such as Newton's laws of motion and the equations of motion. These equations can be solved to determine the position, velocity, and acceleration of an object at any given time, which can then be used to create a trajectory equation.

Can a trajectory equation be used for any type of motion?

Yes, a trajectory equation can be used for any type of motion, as long as the factors that affect the motion (such as velocity, acceleration, and gravity) are known. This includes linear motion, circular motion, and projectile motion.

Are there different types of trajectory equations?

Yes, there are different types of trajectory equations depending on the specific type of motion being studied. For example, there are equations for linear motion, circular motion, and projectile motion. Additionally, there may be variations of these equations that take into account other factors, such as air resistance or friction.

Back
Top