Yeah, everything that’s been said (from my skimming through it) is probably correct. You’re more a graphical person though, here ya go:
“say my position is (3,5) and my view is at (7,9) is there a formula that i can just punch those numbers (or some version of those numbers) into and come up with my position/view coordinates based on which direction i want to move?”
Sure, we’ll do it trig style…
take the delta (difference) between them
(7-3, 9-5) = (4,4)
take the arctan of that (use new_angle=atn2(4,4)
add + (for strafe left) or -(for strafe right) pi/2 radians to the angle (new_angle) you got from atn2
Now, you’ve got your original position (3,5) just add
cos(new_angle) * distance_to_strafe to the x component, and
sin(new_angle) * distance_to_strafe to the y component
Tada! (hope it all works, and) hope you can visualize it. You basically take that direction you’re viewing, find the angle on the unit circle, then + or - 90 degrees (pi/2 radians) to the angle. Then you multiply that new unit circle direction by how far you want to move, then offset your original position.
Any q’s? (Btw, this is probably a really slow way to do this, and it can be done with matricies and all, which is what everyone else is telling you, but hey - figure out what way you understand, then move to a “better” or faster way)
-Michael g.
ps. The position for your view coordinate should obviously also be offset by the strafe value, if you’re trying to continue to view in the same direction.