# Tag Info

2

Your intuition is correct, the easiest way to do it would be to normalize your vector, and then rescale it using the Projectile.maxSpeed. If you need the angle for some reason, you can get the direction to the target by using the atan2, which can be used to convert an x and y difference into a rotation. Here's some C pseudo-code to show you: float x_diff = ...

4

It looks like your trouble isn't in computing the direction - it's that your arrow asset was imported with an unusual orientation, so when you use methods like LookAt or LookRotation they give you the "right" result for a standard orientation, leaving your arrow visually pointing somewhere else. You tried to correct for this by adding angular offsets to the ...

0

Just to answer you question simply: arctangent function atan2(y,x) uses the sign of BOTH parameters to determine the quadrant of the angle in the range -PI to +PI (-180 deg to +180 deg). If you want degrees in the range 0 to 360 do this: struct vector {double x, double y}; // define a 2D vector vector vec{ 3.0,2.0 }; // sets x and y values const double ...

0

The following example isn't using vectors but rather simple unit-circle implemented on javascript: https://github.com/Drooids/unit-circle. More particularly below this line: https://github.com/Drooids/unit-circle/blob/e608e67ed52db89025e0fc4c6900fddcdab01608/unit-circle.js#L391

0

I would suggest calculating you distance from plane first; and then when the distance <= to the radius carry out the collision reaction. You can then alter this to calculate distance and if the distance is less that radius( which mean the object is overlapping) shift the balls position and then carry out the collision reaction.

Top 50 recent answers are included