Share Your Experience: Take the 2024 Developer Survey

# Tag Info

Accepted

### Projectile Aim Prediction with Acceleration

To make things a little simpler, let's work within the inertial frame of our launcher. That means our projectile will be firing from the point (0, 0, 0). (You can subtract any arbitrary firing ...
• 135k
Accepted

### Why aren't game bullets implemented as if they were real bullets?

The main problem is tunneling. Game physics engines typically use discrete collisions. That means they advance all the bodies by one short time step, then check if they're intersecting, and handle ...
• 135k
Accepted

### Guided Missile with Constant Time

The edit is reassuring. :) Okay, here's a straightforward update loop... Assuming when we fire the missile we initialize remainingFlightTime = 5f then... ...
• 135k
Accepted

• 135k
Accepted

### How to make mouse pointer be the vertex of a drawn parabola when estimating the trajectory of a projectile?

I think we can do this more simply. This demo uses about 80 lines of code (the interesting ones being just the dozen below), instead of over 300, with no angles/trigonometry functions needed: At the ...
• 135k

### How can I launch a GameObject at a target if I am given everything except for its launch angle?

I modified DMGregory and Evorlor's solution a bit as I wanted a 3D arc and wanted to be able to apply a minimum speed if the provided speed wouldn't reach. ...
• 21
Accepted

### Calculate initial velocity for trajectory given duration, launch angle, and distance

Note: the situation you describe (angle, start, end, and time of flight) is overdetermined. For many (most) inputs, there will be no solution that simultaneously satisfies all of these constraints. (...
• 135k
Accepted

### Required initial velocity (fixed launch angle) for projectile to hit a target

[Reposted as an answer, at the asker's request] turretAngle is in degrees, so you need to convert it to radians before passing it to ...
• 1,381

### Why aren't game bullets implemented as if they were real bullets?

For most games it doesn't make a difference. Take the Counter Strike series, for example. It simulates firearms combat on rather short distances. On the distances where the average CS shootout takes ...
• 120k
Accepted

### Rifle bullets/projectiles in Unity, raycasting or rigidbody?

A simple raycasting would be instantaneous. This is usually referred to as Hitscan. A simple example would be in Doom, some weapons and enemies hit immediately while others can be dodged after they ...
• 1,330

### Pushing Rigidbody forward doesn't go straight

Those calculations you made are taking into account a direction that is forward of the camera center. But you are instanciating the grenade in an arbitrary transform called ShootPoint. so how to ...
Accepted

### how to calculate initial Y velocity required to reach target?

You are going to need to use the Equations of Motion. This is because the velocity is not constant over the time frame. You cannot calculate distance traveled by velocity and time alone. One way to ...
• 810

### Javelin throw projectile motion

maybe you should position the javelin in such a way, that the 'nose' of the javelin is where the curve is, not in the middle, that way it might look a little 'more natural'. or you can add a turning ...
Accepted

### How do I launch a ballistic projectile to hit a moving target, given: launch position & angle, target position & velocity?

I'm assuming that your gravity acts on the vertical axis, and that your launch angle is an altitude (measured vertically from the horizon, so 0° means firing horizontally, and 90° means firing ...
• 135k
Accepted

### Find the direction a Projectile should be fired from a Moving Object to hit another moving Object?

This is the updated code, with code for handling some edge cases. Also, I made sure the BULLET_SPEED large enough for the Equations to work: ...

### Emulating 3d trajectory in top-down 2d game?

I created this version which uses a target position and t (time 0-1). I would loop this function in an update function if (t < 1) t would increase by ...
Accepted

• 135k

### How could I simulate projectile collision agaisnt RTS units with primitive colliders?

Like DMGregory said: it's very unlikely Total War is actually simulating physics for all those arrows. There's probably a big separation from the battle simulation and the actual animations in game. ...
• 742
Accepted

### How to find the maximum distance a target point can be hit from a launched projectile

Using the code in this answer: ...
• 135k
Accepted

### Model path of bullet to hit future position of balloon

If I understand correctly, the targets move along a path defined as a series of points. So, effectively, it is moving along a series of straight segments, correct? Thus, you could: Solve the time and ...
• 27k
1 vote
Accepted

### Pushing Rigidbody forward doesn't go straight

As previously answered. If you spawn your projectile offset from the camera, and shoot it in the direction of a transform attached to the rifle then it won't line up with the camera because the rifle ...
• 251

Only top scored, non community-wiki answers of a minimum length are eligible