• 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
0
Question by paingel13 · Nov 21, 2013 at 04:59 PM · external controller

How to get enemies to slowly approach first person controller

Hi im trying to make a script in which the enemies will slowly approach the player and will give me a variable on the speed to help control the enemy in later levels.

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Cherno · Nov 21, 2013 at 06:41 PM

Take a look at BurgZerd Arcade's Hack 'n' Slash tutorial series. One of the first videos has exactly what you need.

http://www.burgzergarcade.com/tutorial/unity-game-engine-tutorial-hs2-001

Comment
Add comment · Show 2 · 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 paingel13 · Dec 19, 2013 at 04:37 PM 0
Share

I watched the video but i couldnt find the second part of it and the first video didnt go over much except importing assets from the store.

avatar image AlucardJay · Dec 19, 2013 at 08:45 PM 0
Share

Did you actually try searching for Burgzerg Arcade ???? I mean, it's pretty famous, any search engine would find it.

  • http://www.burgzergarcade.com/hack-slash-rpg-unity3d-game-engine-tutorial

  • http://www.youtube.com/playlist?list=PLE5C2870574BF4B06

avatar image
0

Answer by push_over · Dec 19, 2013 at 05:03 PM

Without an example of your current code and showing us where you're having troubles, the best we can practically do is show you a tutorial (like Cherno did above) and give you a bit of pseudo code.

 private Vector3 _direction;
 // create a new Vector3 for the direction we need to go to get to the player.

 public float movementSpeed = 10.0f;
 // this will be how fast your enemy moves toward the player.


 void Update(){

 _direction = playerObject.transform.position - transform.position;
 // calculate the direction. thankfully, it's very simple
 // within the unity engine by simply subtracting your enemy's
 // position from the player's position.

 transform.Translate(_direction, movementSpeed * Time.deltaTime);
 // this does the actual movement. multiply movementSpeed 
 // by deltaTime to make movement framerate independent.
 }
Comment
Add comment · 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

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

19 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

Related Questions

I need help with my Third Person Controller. Or Animations 0 Answers

how to work my game 0 Answers

Change controls to vehicle controls script? 0 Answers

Why is Unity deleting my prefabs!? 1 Answer

2D Border doesnt allow the nutbomb gameobject to bounce 0 Answers


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