Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 C10110 · Jan 20, 2013 at 02:53 AM · npcwalkingaroundcorner

How To Make An NPC Move When You Look At It

Hello all,

I've searched but can't find exactly what I'm looking for, let me be more specific. I have a hospital environment that has several turns/corners the player must walk around. I also have a man, that I want to walk around each corner before the player does. Let me clarify though.

If the turn is right, and the player is looking left, the man will not walk. Once the player sees the man, he will walk around the corner. Then when you turn the corner, he will just be walking around the next corner etc. This will happen several times. I will then just need him to walk straight after the final turn. - How do I accomplish this? - And yes, I have the model with the animations. I just don't know how to apply it.

Thank you for your time.

P.S. I'm sorry if this is a double post. I typed this all up and then it asked me to log in and I didn't see it posted :/ So I'm hoping it only posted once.

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
Best Answer

Answer by cdrandin · Jan 20, 2013 at 03:10 AM

I had an idea on using a Ray to determine when play visual looking at target. There is no such thing as Ray cone unfortunately. My next idea was having a trigger, if player is in trigger, PREPARE man to walk, but it needs one more condition, if player is in trigger AND visually looking towards this man, have the man perform the action. For this you can use http://docs.unity3d.com/Documentation/ScriptReference/Physics.SphereCast.html this might work, if the spherecast is towards the man object, then activate man to walk.

Comment
Add comment · Show 1 · 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 C10110 · Jan 20, 2013 at 02:42 PM 0
Share

Hey,

Thanks for the quick response! This was useful info. I appreciate you taking the time to lay it out for me and link me to that page. It also sparked a few other ideas as well, so really, thank you.

avatar image
0

Answer by Professor Snake · Jan 20, 2013 at 06:23 PM

You could use the OnBecameVisible() function along with some occlusion culling.

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.

Follow this Question

Answers Answers and Comments

11 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

Related Questions

when i collide with npc he keeps walking. 1 Answer

enemy walking around the room 2d 1 Answer

NPCs following an uneven floor... 0 Answers

Does any one know why this happening - Unity keeps messing with my Math 1 Answer

moving gun in first person shooter while walking 8 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