Hello, so I have a door, and basically what I want is floating text that says “F to interact” but I want that text to appear on the same side that the player is on, but the problem im having is, when I get to the certain point in the doorway the text canvas pops from the left and to the right side at a rapid pace.
So as you can see it works except for, when I am in the doorway it pops back and forward at a rapid pace
You cant see it in the picture but it is going to the left to the right very fast when I am in the doorway
void Update()
{
// if the players position is greater than the doors center put the canvas on the right side of the door
if ((playerCapsule.position.z - transform.position.z) > 0) {
TextCanvas.localPosition = new Vector3 (-1, 0, 1);
}
// if the players position is any negative value realitive to the door, position the canvas on the left side of the door
else {
TextCanvas.localPosition = new Vector3 (-1, 0, -1);
}
}
I have tried a lot of different things including getting a range from 1 to -1 and setting that to not show the text, changing values, and changing the less than sign to less than or equal to, and setting up another if statement for the negative value to move the sign instead of the else, but none of these have worked, Any help is greatly appreciated.