Change projectile angle

projectile motion
how to find angle of projectile launched
projectile motion equations
projectile motion at an angle from a height
how to find the angle of a projectile motion problem
projectile motion calculator
how to find initial velocity of a projectile with angle and distance
projectile motion formula

I'm trying to add accuracy to my game. Currently my player will always fire directly ahead (which is pointing towards the mouse cursor). I would like to offset that firing angle by x degrees.

My firing script currently looks like this :

nextFire = Time.time + bulletConfig.TimeBetweenShots;
var offset = new Vector3(0, 0, 0);
var grid = GameObject.FindObjectOfType<Grid>();
var proj = Instantiate(projectile, transform.position, Quaternion.identity, grid.transform);
proj.transform.position = transform.position + offset;
proj.transform.rotation = transform.rotation;

var controller = proj.GetComponent<BulletController>();
if (controller != null)

Destroy(proj, bulletConfig.DestroyTime);

The core of my problem is that I don't know how to add degrees to a vector3, without some complicated trigonometry.

Any ideas?

As mentioned in the comment:

The documentation for Transform.rotate state: "To rotate an object, use Transform.Rotate."

Modifying your example this would look like this:

// -- snipped for brevity
var proj = Instantiate(projectile, transform.position, Quaternion.identity, grid.transform);
proj.transform.position = transform.position + offset;
proj.transform.rotation = transform.rotation;
// Using the second overload of Transform.Rotate
float exampleOffsetAngle = 1.0f;
proj.transform.Rotate(exampleOffsetAngle, 0.0f, 0.0f);
// -- snipped for brevity

For more examples and usage of the other overloads please refer to the official docs:

Projectile at an angle (video), Figuring out the horizontal displacement for a projectile launched at an angle. The Duration: 12:47 Posted: Jun 9, 2016 A Change In The Initial Of A Projectile Changes The Range And Maximum Height Of The Projectile. O Angle O Velocity O Height All Of The Above < Previous Next > 6. If The Acceleration Due To Gravity Was Larger, A Projectile's Range And Maximum Height For A Particular Set Of Initial Conditions Would Be Than If The Acceleration Due To Gravity Was

Float degrees = 5;
Quaternion q = Quaternion.AngleAxis(Vector3.right, degrees);
proj.transform.rotation = q * proj.transform.rotation;
// Alternatively, if you have a vector vecToRotate:
vecToRotate = q * vecToRotate;

This will move it up by 5 degrees. Use -5 for down. Use something other than Vector3.right for other directions.

Projectile Motion for an Object Launched at an Angle ( Read , The horizontal motion is constant velocity motion and undergoes no changes due to gravity.The analysis of the motion involves dealing with the� Learn about projectile motion vectors and how the launch angle impacts the trajectory. If you're seeing this message, it means we're having trouble loading external resources on our website. If you're behind a web filter, please make sure that the domains * and * are unblocked.

Trigonometry is not exactly complicated, especially not when you have a transformation object that can do the computation for you. "Adding degrees" amounts to rotating the transform of your projectile with the Rotate function.

Projectile Motion for an Object Launched at an Angle, To calculate projectile motion at an angle, first resolve the initial velocity into its horizontal and vertical components. Analysis of projectile motion involves dealing with two motions independently. Vertical components will always have the acceleration of gravity acting on them. "angle" being relative to the over all direction and overrides its current path, eg "angle" : 90, will cause the projectile to travel straight up regardless of what direction its fired at. and "angleadjust" changes the projectiles direction to change relative to the projectiles axis, eg "angleadjust" : 90, will add a 90 degree change in

Projectile Motion, Assess the effect of angle and velocity on the trajectory of the projectile; derive maximum Duration: 13:02 Posted: Mar 29, 2013 Projectile motion (horizontal trajectory) calculator finds the initial and final velocity, initial and final height, maximum height, horizontal distance, flight duration, time to reach maximum height, and launch and landing angle parameters of projectile motion in physics.

Non-Horizontally Launched Projectile Problems, of analyzing and solving a problem in which a projectile is launched at an angle to the Change a height, change an angle, change a speed, and launch the� We would like to suggest that you combine the reading of this page with the use of our Projectile Motion Simulator. You can find it in the Physics Interactives section of our website. The simulator allows one to explore projectile motion concepts in an interactive manner. Change a height, change an angle, change a speed, and launch the projectile.

Horizontal and Vertical Velocity of a Projectile, But its vertical velocity changes by -9.8 m/s each second of motion. But what if the projectile is launched upward at an angle to the horizontal? How would the� The angle at which the object is launched dictates the range, height, and time of flight the object will experience while in projectile motion. shows different paths for the same object being launched at the same initial velocity and different launch angles.

  • From the docs: "To rotate an object, use Transform.Rotate." - and that one takes euler angles as parameter
  • @UnholySheep, this was the answer I was looking for. Would you like to create an answer, so I can accept it? Thanks!