i’m using this look at script for the characters to look at each other pretty much a fighting game but they are not facing each other they are pretty much facing back to back.
var target : Transform;
function Update ()
{
var newRotation = Quaternion.LookRotation(transform.position - target.position, Vector3.forward);
var orientTransform = transform.position.x;
var orientTarget = target.position.x;
if(orientTransform > orientTarget)
{
newRotation = Quaternion.LookRotation(transform.position - target.position, -Vector3.forward);
}
newRotation.x = 0.0;
newRotation.z = 0.0;
transform.rotation = Quaternion.Lerp(transform.rotation, newRotation, Time.deltaTime * 20);
}
please help all i need to do is learn how to flip them it’s like it’s walking backwards and when i jump over the enemy and it flips it’s still face the enemy backwards.
ah, i had the same problem when i was working on my weeping angels, whats basically happening is what the computer sees as the “front” of the object is different to what is visibly the front to you. the solution is to create a cube or something, make it’s “front” (in the computer’s perspective) the same as the front of the model you are using, then put the model’s objects underneath the cube in the heighrachy. call the cube “ControlCube” or something, remove the mesh renderer by un-checking the box on the right, and apply the script to the box instead of the model. that should solve your problem!
hope i was helpful! love from freakfish 
i did something like that in several different ways and it will always still face on the -Z direction.
and if i put it on the hieralchy the objects finally faces the enemy but once it jumps in order to rotate to the other side the script doesn’t work anymore
i even used simple cubes and objects to see what’s going on see if the model was just modeled badand still faced the wrong way
i just need to invert the z axis somehow.
If the problem is simply that your characters face the wrong way (by 180 degrees), the problem is probably this line:
var newRotation = Quaternion.LookRotation(
transform.position - target.position, Vector3.forward);
Instead, try this:
var newRotation = Quaternion.LookRotation(
target.position - transform.position, Vector3.forward);
Depending on how your game is oriented, you may need to change ‘Vector3.forward’ to some other vector as well. (If +/-z is up in your game though, you should be good.)
Thanks for the help in the end I went to the irc website and someone saw my whole code plus the one for the character and the main reason was ,ore like a bug be use I was working by using Euler angles so when I wrote the code using quaternion it actually added more degrees to the rotations making even the simple cubes look backwards
So I had to rewrite the Conde for Euler angles nut thanks you where right to at one point but that code made the character flip around once you jumped over the enemy so it always faces the enemy