Hi
Is there any method to having used Vector3.left on an object to move it left and then switch camera view on it to the opposite 3d side of the objects and then not move it to the right with Vector3.left.
What do you do?
Hi
Is there any method to having used Vector3.left on an object to move it left and then switch camera view on it to the opposite 3d side of the objects and then not move it to the right with Vector3.left.
What do you do?
If I can attempt to rephrase what you’re asking, since it’s not entirely clear to me: You currently have a control that moves a character to the left in world space, what you want to do is have him move to the left based on whatever the direction is the camera is facing. Is that about right?
Its complicated to explain what I have but I can tell you Im playing with this function
Vector3 selectleft = highlighted.transform.TransformDirection(Vector3.left);
if (Physics.Raycast(highlighted.transform.position, selectleft, out hit))
and when I goto the opposite north side of the screen it acts like RIGHT instead of left. It shoot the raycast to the wrong side I think.
Not sure what to use, Im beginner with Unity3d.
Camera.main.transform.right
This is what Im looking for.
Camera.main.transform.down Does not work
Right seems to work and left dont work. Any ideas?
If I understand correctly, You could make a Vector3 called Right, and add in the values that make it the opposite of Vector3.left, seperating the two. I’m pretty much a newb, though, so I might be talking out of my butt. But I think that should work if I understood correctly what you’re trying to accomplish here.
I found an answer but funny to leave out left and down
-Camera.main.transform.left
you can use minus sign to get opposite.
Glad you figured it out! ![]()
It’s always fun to make things work, I managed to figure out how to make a first person cam that finds the target, takes its position and makes it a parent to the camera without the typical public Transform myTarget; stuff, also managed to make it so the player is always facing the cam’s direction. That was a pain… but i figured it out all on my own
transform.eulerAngles was the key.
Also managed to smoothen the mouse movement with Mathf.SmoothDamp though. Was a blast learning to do all that!
Simple stuff, but still. It’s an accomplishment nevertheless.
Anyways, have fun with your future projects.