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 /
This question was closed Mar 02, 2014 at 03:30 AM by robertbu for the following reason:

Multiple technical questions/Don't code to spec

This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by valrossen_Oliver · Mar 02, 2014 at 03:22 AM · javascriptnavmeshagent

Create Waypoint on mouseclick

So I have created 2 NavMeshAgent's to go to their own target. The Foe has a already placed target. But I want to be able to put out my Player agent's target mid game. So the way I want this is that I want to point the mouse to a specific area and click to place the prefab/navmesh target (within 10 meters from player) on the map. Code for NavMeshagent:

 var target: Transform;
 var mesh: NavMesh;

 private var agent: NavMeshAgent;

 function Start () {
     agent = GetComponent.<NavMeshAgent>();
     agent.SetDestination(target.position);
 }

Code needed for target placement:

     1. get mouse possition
     2. place prefab/target
     3. make agent go there

Please Help!

Comment
Add comment · Show 2
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 robertbu · Mar 02, 2014 at 03:32 AM 0
Share

The way I read you question, you are asking for specific code to be written for you. That is not how this list works. We help you solve your problems so you can write your own code. The code to find a position in world space on a mouse click has been posted 1000's of times, as well as instantiating an object at a position. Please research these topics. If you get stuck ask back along with the code you are working on.

avatar image valrossen_Oliver · Mar 02, 2014 at 10:16 AM 0
Share

I understand completely, kinda asked for to much. But however, I never find any solution myself to any of these 1000's times... I must be rely bad at research. Can you please send me a link if it's ok :)

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

20 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

Related Questions

How to make speed changed in js 1 Answer

Duplicating NavMesh Objects 0 Answers

I get NullReferenceException when I use raycasts 0 Answers

Script issues [js] 0 Answers

Unable to enable or disable NavMeshAgent through script? 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