Look at object when entering a trigger

Hi, I am trying to get my player to rotate and look at the trigger (box) when entering the trigger.

Setup

  1. Player
  2. trigger

What happens

  1. Player approaches trigger (just a box) and is e.g. 90 degrees forward from the player position.
  2. Player smooth rotates and positions itself to look at the trigger (rotates 90 degrees).

Problem
I have tried getting the triggers velocity and applying a smooth look at but it always looks at the triggers Z axis. This causes problems when re-entering the same trigger from another angle e.g. opposite side, as this causes the player to flip around e.g. 180 degrees?

Anyway im pretty much lost on what to do now. Hope this makes sense.

Example diagram
[18462-rotate+towards.jpg|18462]

Any advice would be appreciated

Nick

If you are trying to make your player look at the same direction as the trigger you should use in an Update()

Quaternion.RotateTowards(player.transform.rotation, trigger.transform.rotation, Time.deltaTime * lookAtSpeed);

It should take the shorter path in every situation.

Hope that helps

EDIT

You should cut your trigger in different little triggers. Each trigger will give a direction to the player when the player collide with it.

18694-untitled-1.jpg

When the player will colide with A it will take the orientation of A (blue arrow)
When the player will colide with B it will take the orientation of B

Would that work ?

EDIT typos