I have an object A and B. When I click on object B, A rotates to object B (A faces B). B doesn't face A. What I need to do is following : When A faces B, I need A to face opposite direction. I have code for A rotating to look at B. How to rotate to face opposite direction after that?
Vector3 targetDirection = target - transform.position;
float step = speed * Time.deltaTime;
Vector3 newDirection = Vector3.RotateTowards (turretDome.transform.forward, targetDirection, step, 0.0F);
turretDome.transform.rotation = Quaternion.LookRotation (newDirection);
You say object A is already facing object B, all you want to do is inverse the direction of object A after that?
objectA.transform.rotation = Quaternion.Inverse(objectA.transform.rotation)
But lets assume from your example that turretDome is object A, then you could do this (negate the direction):
turretDome.transform.rotation = Quaternion.LookRotation (-newDirection);
Naturally, both of these snippets do not show how to smoothen the rotation, as you already seem to know how to use time.deltaTime.
Just incase you are unsure, Quaternion.Lerp will help you do this