Hot answers tagged

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 ...


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 = ...



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