How do I make a flashlight point to a specifc spot when on a ledge?

At one part of my game the Character reaches a dark chasm, there is a platform below him that he can jump to. But the only way the player can know if the platform is there is if the player illuminates it with his flashlight, but the flashlight is always facing forwards. How do I make the game detect the player is at the ledge, and thus lower the flashlight towards the platform?

Hi,

You could create a Invisible box, with a trigger. When the user steps into it use the transform.lookat lookatlink command and set it to the platform, that way the light will point at it. You could also use a Slerp command to make the light move slowly.

public GameObject Flashlight;
void OnTriggerEnter(Collider other) {
	
	Flashlight.lookat(gameObject);

}

And restore its rotations on exiting the trigger.