Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Slenderman Follow&Teleport Script

Discussion in 'Scripting' started by X-BullDog, Jul 7, 2013.

  1. X-BullDog

    X-BullDog

    Joined:
    Dec 26, 2012
    Posts:
    15
    Hello People!
    I'm working on a Slender-Game into a Castle and I need help with the Slender-Script.
    I need a Script for Slender optimized for a Castle Scene, Follow&Teleport.
    I find some Scripts in this Forum but all wouldn't work because them are scripted for a Wood.
    Please help me ;(

    Thanks! :grin:



    PS: I hope all understand because I'm from Austria ;)
     
  2. YodelYum

    YodelYum

    Joined:
    Apr 3, 2013
    Posts:
    44
    You know a forum is actually ment to be a place where you get help if you have problems with writing your own script or getting our head around how to solve certain problems. Besides, if you only copy/paste other scripts not only will they never work exactly as you want, as long as you don't write them yourself, you'll never know what exactly is going on inside the script and changes will be very hard to make.

    Instead of getting other people's scripts try to solve the problems yourself and ask on the forum if your stuck. Btw, scripting a slender-like behaviour isn't that hard to achieve. Slenderman doesn't walk by himself, so no animation is needed, he just 'jumps' around so you only need tp set new positions.

    Take a look at the Unity-Documentation, there is a lot of helpful stuff. Besides, only typing 'unity slender tutorial' into Google gives you instantly some Video-Tutorials on how to make a Slendergame.

    Good luck
     
  3. shaderop

    shaderop

    Joined:
    Nov 24, 2010
    Posts:
    942
    I think that every possible Slender-Question has already been Slender-Asked on these forums already. So you might want to do a bit of Slender-Search and a bit of Slender-Learn and you should be well on your Slender-Way in no time.
     
    Mokzen likes this.
  4. X-BullDog

    X-BullDog

    Joined:
    Dec 26, 2012
    Posts:
    15
    I searched for Slender Tutorials but them are for a slender-game in the Wood, not in a house ;)
     
  5. Jacksendary

    Jacksendary

    Joined:
    Jan 31, 2012
    Posts:
    408
  6. xtremepman

    xtremepman

    Joined:
    Jul 18, 2012
    Posts:
    388
  7. RealPpTheBest

    RealPpTheBest

    Joined:
    Jan 27, 2019
    Posts:
    64
    Ok, so basically first make a slender script which teleports it.. now for the collision detection part you can basically:

    Create a bool to determine if a collision has happened
    Code (CSharp):
    1.     private bool collided = false; // use this to keep track of collision with the obstacle
    2.  
    Then, use the basic OnCollision functions:
    Code (CSharp):
    1.     void OnCollisionEnter (Collision col)
    2.     {
    3.         if (col.gameObject.transform.tag == "Obstacle") //If collider of this gameobject touches the gameobject with tag Obstacle
    4.         {
    5.             collided = true;
    6.         }
    7.     }
    8.    
    9.     void OnCollisionExit (Collision col)
    10.     {
    11.         if (col.gameObject.transform.tag == "Obstacle") //If collider of this gameobject doesn't touches the gameobject with tag Obstacle
    12.         {
    13.             collided = false;
    14.         }
    15.     }
    Then add this to your code:
    Code (CSharp):
    1. if (collided == false)
    2.                 {
    3.                    //Collision is false, so stay there
    4.                 }
    5.                 else
    6.                 {
    7.                   //A collision just happened, find another spot to teleport.
    8.                 }
    It works for me.. hope it works for you as well.