Amateur Gamedev General ~ /agdg/ + /vm/

How can I flatten my Direction vector so that it only points in two directions to the left and right of my character?

I basically want my character to sidestep but I'm drawing a blank on how to get this working.
Using unity

I don't understand. Do you mean that you don't want to allow diagonal vectors (relative to the player)?

You shouldn't have two vectors that point to the left or right of your character, you should have one vector that points left or right, and you set it negative if you want it to go the other direction.

had a dream last night that i animated, as in i dreamt all night that i was sitting at my computer animating.
wake up
realize that it was all a dream
have none of it saved
motivation destroyed

Finally got the dirt texture looking halfway decent (I'm using a modified NES palette with extra RGB+grey ramps)

I have one single vector that I use to move in a 3D space, I basically just want to make that vector into something that I can use to move my character in +Y and -Y.

Shit, I just realized I had a minor art subtheme with the 4 card suits. Think it's worth the effort to change the key shapes?

Are you talking about strafing in 3 dimensions?
If so, what you can do is to create a new vector3 holding only the information for movement in local space (in your case this might just be direction in y), normalize it, convert it to world space using TransformDirection, give it the magnitude required then add it to your current direction vector.
Alternatively you can get the cross product of the local forward and up vectors to receive a vector pointing to the left or right of your character than do with that as you please.
I'm not a neat coder, so there's probably a better way of doing it.

When you say you want to "flatten" a vector, that means you're flattening it relative to something.
So, in most cases it's flattening relative to a plane (so, surface normal or world up (0,1,0), so it's a direction relative to a plane), or relative to a direction (projecting a vector in a particular normalized direction that's the original vector's magnitude).
Respectively, these are the ProjectOnPlane, and Project vector3 methods.

so… as to get a basis for what we're dealing with here: does your character's forward transform move relative to your directional vector?
i.e. set the character's transform forward as the dir vector?
if so, just get the transform right dir (side step dir), and just add in that dir.
if not (i don't see why not, use the tools built for this), you can use a cross product to get the right direction of your character's forward/up, to get the right axis dir; then add in that dir for a side step.

correction