Questions tagged [projectile-physics]

The motion physics of the objects sailing through the air, ranging from thrown baseballs to battleship cannonfire to falling rocks.

Filter by
Sorted by
Tagged with
0 votes
2 answers
66 views

Simulate Velocity For A Projectile Moving Along A Spline

I'm using Unity's latest Splines package(v2.5) to move a projectile across a spline with speed. It works perfectly and the projectile moves across the spline to it's target with linear speed. But I'd ...
PayasoPrince's user avatar
0 votes
0 answers
50 views

How to animate a ball with fake physics from top down viewing angle

I am making a 2D American football game (similar to retro bowl) in Game Maker: Studio 2, and its main perspective is in 2D. I want to animate a ball that moves in a parabola and can interact with ...
Gabriel Toy's user avatar
0 votes
1 answer
40 views

Time aware point -> capsule swept collision detection?

the simplicity of Minkowski sums are one of the big reasons capsules are used in collision detection, especially for player models. One of the benefits of this should be the ability to perform ...
Krupip's user avatar
  • 1,713
1 vote
0 answers
41 views

Trying to plot trajectory of rocket using only its current position and velocity components

I have a 2D controllable rocket for which I want to plot the parabolic motion. Additionally, the parabola should be able to change due to the thrust of the rocket accelerating it in either direction. ...
confused_aspirant's user avatar
1 vote
0 answers
129 views

Deflecting projectiles back towards enemies

I am working on a 2D side scroller. I have created an enemy character that shoots at my player randomly within a specific time interval. So, I want to deflect the projectiles back toward the enemy ...
shanksVR's user avatar
0 votes
1 answer
105 views

How to launch a soccer ball on a parabolic path in a 2.5D game?

I am trying to make simple 2D soccer game in Unity, but I feel a top-down view in such simple games isn't as exciting as the pseudo-3D view in games like Kunio Kun Nekketsu Soccer League. I am trying ...
Karlsson's user avatar
0 votes
0 answers
29 views

How do some RTS games efficiently compute the launch angle of projectiles to hit moving targets, accounting for gravity? [duplicate]

Some real-time strategy games, notably Total Annihilation and Supreme Commander among others, have simulated projectiles that travel along realistic-looking parabolic arcs to reliably hit moving ...
bluegreen1024's user avatar
0 votes
1 answer
102 views

Bullets shooting all over the place

I have created a simple player controller, which contains the player logic for a movement, aim and shooting bullets from a gun. Everything almost works, except the bullets shoot in random directions, ...
Laurens van Oorschot's user avatar
0 votes
1 answer
50 views

Modify ballistic code to not rotate projectile

I am currently using this formula to fire a projectile in my game. Credit to Stephan-B for this wonderful formula: https://forum.unity.com/threads/throw-an-object-along-a-parabola.158855/ ...
PayasoPrince's user avatar
0 votes
0 answers
155 views

Why is the player being pushed backwards when shooting bullets?

I am trying to get a player to be able to shoot bullets, but it causes the player to push backwards and the bullets don't correctly work. The bullets shoot, but then the bullets will only disappear ...
Laurens van Oorschot's user avatar
0 votes
0 answers
64 views

Mouse position as target, with arced (curved) shot

I am trying to write a game with artillery mortar fire I have another gun adjusting & firing towards the mouse, but would like to switch weapons. I am having problems with how to fire a shell up ...
Tomjtp's user avatar
  • 1
0 votes
1 answer
160 views

Calculate angle for arrow tip to hit a point

For an archer in my game, I want to calculate the launch angle to hit a point (x,y) when fired from (0,0). The initial power is known, so I use the following formula: https://en.wikipedia.org/wiki/...
John's user avatar
  • 13
0 votes
1 answer
252 views

Projectile arc velocity changes depending on target x-axis position

I am trying to create an enemy for a 2D platformer that launches a projectile in an arc at the player position (think throwing a grenade, launching an arrow style parabola). Everything works as ...
Delagore's user avatar
1 vote
1 answer
122 views

Model path of bullet to hit future position of balloon

I am coding a Bloons Tower Defense Game and one of the problems I have is how to shoot a projectile from a tower and have it hit a balloon that is moving along a certain path. The way I am currently ...
Aayush's user avatar
  • 47
1 vote
0 answers
296 views

Aircraft simulation

Trying to get a "semi" realistic aircraft simulator. I'm pulling my hair out because I just can't get the math right. I'm not looking for super realistic but want to at least get some ...
K2xL's user avatar
  • 111
0 votes
1 answer
467 views

Intercept an accelerating object with a constant velocity projectile

I want to calculate the time that it takes to intercept a moving target "plane" with a projectile. For example I have two 3 dimensional vectors (2 locations in 3D space). ...
nexo sharp's user avatar
0 votes
1 answer
593 views

How to make a capsule Rigidbody player "kick" a Rigidbody sphere (ball) in Unity?

I am just learning the basics of physics simulation with rigidbodies. I am trying to simulate some basic real world functions like kicking a ball. Let's say I have a simple capsule mesh/collider as my ...
mike's user avatar
  • 481
0 votes
1 answer
174 views

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

I'm determining a trajectory necessary to hit target B with a projectile launched from point A with a given velocity. No problems there. Obviously, not all points B can be hit with a fixed velocity, ...
IanLarson's user avatar
  • 771
1 vote
0 answers
108 views

How can I predict if a Guided Projectile can hit a stationary Target (with no adjustments to aim)?

I'm trying to predetermine if a projectile will hit a target (before the projectile has been fired). The projectile settings include an Initial Speed, Acceleration, Max Speed, and a Turn Rate. I'm ...
Charles S.'s user avatar
0 votes
1 answer
146 views

Calculating time taken for projectile to reach height (y) and position (xz) at that time in 3D space

I am trying to calculate, given a Rigidbody and a float height, at what time will the ...
anothershrubery's user avatar
2 votes
1 answer
189 views

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

I'm trying to remake an old flash game using Unity. The main mechanic of the game is to make the basketball pass over the mouse. Here's a video of the game: https://www.youtube.com/watch?v=6sArMC1l_Sc ...
Juansero29's user avatar
1 vote
2 answers
180 views

Simulating a rocket out of control in Box2D

In the void of space, a spaceship releases a rectangle shaped space-torpedo. In half a second, it starts its rocket engine and goes straight until something get in its way, and then boom! The code ...
Alex CB's user avatar
  • 376
1 vote
0 answers
24 views

How can I calculate initial X and Y velocity given the starting coordinates, target coordinates, friction and duration? (No gravity)

I am really new to mixing physics and game development, and I would like to find the initial velocity required to launch the gray dot from point A to point B, given a time. I’ve tried many tutorials ...
user153929's user avatar
0 votes
1 answer
124 views

How do I make a bomb sight accurately?

On the Bombsight Wikipedia page, I get that equation. I do not understand it very well. How would I go about writing that in C#? The drag doesn't matter in my project. It's not a flight sim. I know ...
Privvet's user avatar
1 vote
1 answer
154 views

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

For example, humans are easy they are just capsules. But for cavalry, an arrow could hit the horse or the rider. Right now cavalry are also capsule colliders for unit-unit collision, but for ...
Tree3708's user avatar
1 vote
0 answers
265 views

How to make a catapult work with physics and colliders?

This should be my final question regarding getting a catapult to throw something in unity. On my last question, someone suggested starting with something simpler (which I apologize for not doing ...
Nathan Wolf's user avatar
0 votes
0 answers
18 views

Colliders stop working when they move [duplicate]

I'm trying to make a game where you play basketball as a catapult. Obviously an idea like this leans heavily on the unity physics engine. The cup of the catapult has a bucket on it to keep the ball ...
Nathan Wolf's user avatar
1 vote
4 answers
373 views

When an object is launched off-screen, is there any way to know if it's coming back?

In this scene, the object becomes invisible and then comes back In this scene, the object becomes invisible but does not come back Is there any way I can tell if an object will come back when it ...
Sean Carey's user avatar
0 votes
0 answers
41 views

Calculate hockey puck bouncing off rubber bumper

I am very new to game development (or any type of development for that matter) and I am trying to figure out how I would calculate a hockey type puck bouncing off a rubber bumper placed at a 45 degree ...
Jinxy's user avatar
  • 1
2 votes
2 answers
343 views

Interpolation on Rigidbody2D not working

I'm trying to achieve smooth movement for a ball. I seem to be failing to achieve this and now I've created a sample scene, which shows my setup from the game and the problem exists in that sample ...
iQew's user avatar
  • 460
0 votes
1 answer
59 views

The farther I move my character, the more its projectiles fire in the wrong direction

I'm making a top down shooter, and the movement is working fine. However, I'm having trouble getting my Fire function to work correctly. When I run the game, it kind of fires in the right direction, ...
ang1019's user avatar
0 votes
0 answers
31 views

Strange momentum on projectiles shot out of "parent" object

I'm trying to shoot a projectile out of a moving "parent" object. Both objects move off of rigidbody physics, so I'm using addforce for the projectile. Whenever I move the "parent" ...
HongCruise's user avatar
2 votes
1 answer
417 views

How to calculate trajectory on a planet with drag factor

I'm curious what is the valid calculation of a projectile trajectory in case when: surface is not flat but spherical like a planet drag is enabled (for example 0.1) and we are in 3D I've found ...
Panthesilea's user avatar
2 votes
1 answer
955 views

Find projectile initial velocity, and air time, given projectile elevation, distance, angle

I have a target X position (D). I have a turret Y elevation (E). Turret is always pointed at 45 degrees (A). I need to calculate the initial projectile velocity required to hit the target, with an ...
JoeyJoJo's user avatar
3 votes
3 answers
652 views

How to predict where the soccer ball should be intercepted by an AI player after being kicked?

This question has been asked many times before, but most of the answers give solution to the problem where ball (target) is assumed to be moving at a constant velocity. In my scenario, I'm making a ...
Ashish Gogna's user avatar
0 votes
1 answer
649 views

How to create a projectile path in unity using physics

I want to create a jump function that launches a RigidBody2D along a low, long, trajectory. In the following examples, I have set the linear and angular drag to 0, to eliminate any possibility of ...
Luke Mathwalker's user avatar
0 votes
0 answers
1k views

Optimize spawn & destroy? (Unreal Engine)

I'd really like to know how you'd go about optimizing this? 20 actors each spawning 8 projectiles per 0.1 sec which are then destroyed 0.8 seconds later, all done through blueprints Gif: https://gyazo....
Cheryl's user avatar
  • 1
0 votes
1 answer
460 views

My bullets won't bounce in Unity?

I wanted bullets to bounce when they hit walls. However when colliding with a wall, they just jitter about on them. I didn't want to create a new physics material as I want to keep the ball moving at ...
kayra yorulmaz's user avatar
0 votes
0 answers
28 views

How do I calculate the required force to launch an object? [duplicate]

I want to use a rigidbody AddForce() method on an object to launch it over from the enemy to the player, like throwing a ball at a target. The problem is, I'm not ...
Jiehfeng's user avatar
  • 145
0 votes
1 answer
312 views

Rotating projectile in direction it is moving

I am using a parabola curve to launch my arrows: ...
Majs's user avatar
  • 395
0 votes
1 answer
580 views

OnTriggerEnter works...sometimes

I was working on a small game in which you shoot projectiles towards various targets, now I decide to use OnTriggerEnter instead of OnCollisionEnter because OnCollisionEnter adds a slight force to the ...
Gozmetaiemax's user avatar
1 vote
1 answer
249 views

Apply impulse in direction line is pointing with force proportional to the length of line

I have a line perpetually pointed at the mouse and originating at the player, but the length is limited to a certain value. I also can create a circular object on demand in Box2D (specifically the ...
Allister's user avatar
  • 121
0 votes
1 answer
60 views

How can velocity be normalized after a collision if a projectile needs to maintain its height?

I want a thrown disc to travel along the same height, even after collisions. The problem is, there's an edge case that I'm not sure how to deal with. The lowest-tech solution would probably be to ...
Roderick's user avatar
  • 121
2 votes
2 answers
2k views

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

As the title suggests, I am wondering if it's possible to emulate a 3d arrow trajectory to a top-down 2d game? If you would look at this clip of Age of Empires 2 game, especially when archers are ...
Kintaro's user avatar
  • 31
0 votes
1 answer
215 views

AddForce results in stuttering movement

I'm currently developing a simple breakout/arkanoid mobile game. Now, I noticed that my ball movement is noticably stuttering. I've read various approaches about how to make the ball move and decided ...
iQew's user avatar
  • 460
0 votes
1 answer
195 views

How do I account for the velocity difference between a ship and it's fired projectile?

In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as ...
Gozmetaiemax's user avatar
0 votes
1 answer
2k views

Shoot projectile same direction weapon faces

I want to be able to shoot a projectile from a weapon mounted on a vehicle. Right now I am able to do it but only in front of the vehicle. I managed to rotate the weapon to the direction the mouse is ...
Hector's user avatar
  • 85
1 vote
0 answers
67 views

How to vary the initial velocity of a jump based on hold time?

What I want to do is, the longer player holds the screen, the longer distance the object will jump when they release the hold. Here is my code: ...
ken's user avatar
  • 125
1 vote
1 answer
161 views

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

I am trying to do a simple AI Controller, which fires Missiles at the surrounding targets in the Scene. The AI Controller can fire projectiles when moving or stationary. The Targets are either ...
Vignesh Gunasekaran's user avatar
0 votes
1 answer
2k views

How to make a smooth projectile in roblox?

I am trying to make a projectile (Energy ball) for my game. I am using body velocities, but the issue is is that it seems laggy. I shoot it then half a second through flight it seems to stop in mid ...
user avatar