• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-2
Question by jazza · Aug 04, 2012 at 11:04 AM · gameobjectaudiocustom

How to make a Slender man follow character script

hi guys i was just wondering if anybody new how to make a script so that the 'slenderman' teleports to positions near the player, and gets closer and closer, sorry for the big ask but could anyone help me out?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DESTRUKTORR · Aug 06, 2012 at 04:28 PM 4
Share

This is a little bit too much to be asking, I think. If you want to grow, as a programmer, you need to learn some basic problem solving, and try something on your own, first.

Just take a step back and try to figure out what you need to do, overall, then come back and ask questions if your code isn't working right. Good luck!

avatar image jazza · Aug 08, 2012 at 01:20 PM 0
Share

kay, thanks!

avatar image babyjay521 · Feb 11, 2013 at 02:59 AM 1
Share

The basic idea is getting the player's position, and changing the slenderman's position in relation to it. Also, you could use RayCasts to find trees and other items that the slenderman could hide behind, and position him so he is there, etc. But like DESTRU$$anonymous$$TORR said, you will really grow as a programmer if you take on this project by yourself. Trust me, it is much more satisfying to see your own program work than to copy and paste someone else's into your game. Also, you will have a better understanding of the program, and you'll be able to make it to best fit you needs. Hope everything works out well for you! EDIT: Just realized how old this was, sorry to bring it back up haha.

avatar image Unitraxx · Apr 04, 2013 at 12:31 AM 0
Share

I actually can't believe it got -6, it's a well-formed question. Ok maybe not a good question for on UAnswers but there's some real rubbish out there that doesn't even get -1.

6 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by GameMakerJake · Aug 22, 2012 at 09:27 PM

//target to follow var target : Transform;

//Checks his position, used to follow the target var pos : Transform;

//Ray variables (Length... etc.) var rayLength : float = 3;

//Movement, speed etc. var speed : float = 2;

//You can move if he is not being looked at var move : boolean = false;

//I had problems with my model sinking into the floor, adjust this variable if you need it, or remove it function FixedUpdate() { transform.position.y = 2; }

function Update() { //Setting up Raycast variables for simple object avoidance var fwd = transform.TransformDirection (Vector3.forward); var hit : RaycastHit;

     //If you are looking at the object...
     if (renderer.isVisible)
     {
     move = false;
     }
    
     //If you are NOT looking at the object...
     if(!renderer.isVisible)
     {
     move = true;
     }
 
     //If you are not looking at the object...
     if(move)
     {
     //Make him look at the target
     transform.LookAt(target);
     //Always follow the target
     pos.position += pos.forward * speed * Time.deltaTime;
     }
    
     //If he is 3 units away from something, move right (Works if you are not looking at the object)
     if (Physics.Raycast (transform.position, fwd, rayLength) && move)
     {
     Debug.Log("Something ahead, moving");
     transform.Translate(Vector3.right * 3 * Time.deltaTime);
     }
 

}

Idk if that's what you're looking for?

Comment
Add comment · Show 11 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hecike3 · Aug 24, 2012 at 03:38 PM 0
Share

Thanks alot ! <3 but i have some error so please tell me how i use it .. PLS..

avatar image Mander · Aug 24, 2012 at 03:47 PM 0
Share

what errors?

avatar image hecike3 · Aug 24, 2012 at 03:49 PM 0
Share

parsing error at line 47,5

avatar image Ruffy789 · Aug 26, 2012 at 11:37 AM 0
Share

I got it to work by adding a box collision and using gravity. (Only works if he floats not if he sinks.)

avatar image blackpantherxx · Sep 17, 2012 at 02:33 PM 0
Share

Assets/Slender.cs(1,6): error CS8025: Parsing error

error in : if(renderer.isVisible (the first line)

Show more comments
  • ‹
  • 1
  • 2

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

48 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Slender like game 3 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

GameObject reacts to audio source 1 Answer

Music works but not when accessed by another script in JavaScript 1 Answer

Get acess and switch to many audio source in a single Object HELP!! 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges