Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 zankor · Jan 08, 2017 at 06:32 PM · movementraycastplayermovetowardsscreenpointtoray

My Player is crossing the ground through air

Hello, player is going over the ground as you can see in the video below. I want to make that the player can move only on the ground. Im using raycast and moveTowards for movement right now. thank you in advance for your help

problem here: https://youtu.be/1U423hWNbJo script here: http://prntscr.com/dsk14h

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by GrayMatterTutorials · Jan 09, 2017 at 08:09 AM

Alright! @zankor, you need a waypoint system! What you are going to do is basically set up a connection with every single grid cell you have. Say you start at a grid cell and want to get to a grid cell on the other side of the map. You will set that other grid cell as your destination and ask the controller script for a path that gets you there. It will take your current position, check the nearby grid cells, and if they move closer to the object, they add themselves to the path. This continues until you reach the destination. Then the controller sends you a list of waypoints (grid cells) you have to travel across before you get to the destination. That will ensure they stay on the ground. My suggestion, look up the A* Pathfinding Design Pattern. This will give you an in-depth overview of creating a smart AI to transverse this type of terrain. Here's a good video describing it: https://www.youtube.com/watch?v=-L-WgKMFuhE. Best of luck to you! If you have anymore questions, feel free to comment.

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 zankor · Jan 11, 2017 at 08:14 PM 0
Share

thank you for pointing me in the right direction!

avatar image GrayMatterTutorials zankor · Jan 12, 2017 at 02:08 AM 0
Share

It's no problem, that's what we are here for! If you have any further questions related to this, feel free to comment below and I will help you out as much as I can. If you have any new questions that are completely unrelated from this, start a new question, I'll keep my eye out!

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Push an object opposite direction of mouse position 0 Answers

Move player between 3 given points only by touching on the left/right side of the screen 1 Answer

AI behaviour in 3D game, general help needed 2 Answers

how to stop something from following in the y axis 1 Answer

Using MoveTowards on button click 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