How to make an object fallow you and disapear

i thing how i put an object and when i turn it disapear , but i need a script like slender game , when you turn around you see a model, but when u look foward and again turn around its not there anymore…

thanks a lot i dont know so much about scripting, so can u tell me guys where put the script that u will give me :slight_smile: thanks a lot

What is it about Slender nowadays!!?? Everyone comes with “I want to do like in Slender”.

Well, what you could do is have your guy following with a LookAt(player). You could just check if the NPC is not getting too close with Vector3.Distance(player,npc) and in the case he is too close you prevent him from moving.

For the disappearing, you can use Vector3.Dot(player.transform.forward,npc.transform.forward). It will return a value between -1 and 1. If the value is positive, then you are facing your guy with less than 90degrees, “blop” he disappears.

If you use

if(Vector3.Dot()>0)Disappear();

The follower disappears at 90degrees.

You could use instead

if(Vector3.Dot()>0.5)Disappear();

So that it goes away at 45degrees, you actually get to see him. More scary.

Thanks a lot dude ! :slight_smile: