How do I make it so that transform.forward only affects the x and z axis.
This is a difficult question to give a straight answer to… so… why? What is the use case?
Transform.forward is basically taking a given gameobject, and taking its rotation into account, it tells you the direction that is “forward” on the local Z axis of that object.
So like, there is no “effect” per say on the X axis… or any axis… the “effect” of transform.forward is simply that it tells you which way is forward ![]()
Wish I could help you more but I simply don’t understand what your getting at, and I think you should provide much more detail about what you want to accomplish, what your currently trying and have tried already, and why it doesn’t produce the result you wanted. Then somebody will be able to help you much better.
Anyway I’ll take a shot in the dark here, perhaps you need to use Vector3.forward for some reason? Perhaps your doing 2D stuff, and should be using Vector2.right or Vector2.left? Again I have no idea what is going on ![]()