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
2
Question by Tyler 2 · Dec 06, 2010 at 06:42 AM · movementtransformrandom

Random Movement?

Hello. How can I have an object move automatically from point A to point B, but take a random route? Thanks.

Comment
Add comment · Show 1
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 Bampf · Dec 06, 2010 at 02:06 PM 0
Share

Your question is too broad. Is this a random route through open space, or are there obstacles? 2D or 3D? Is this quantized movement on a grid? Is it turn-based or continuous? Is physics involved?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Proclyon · Dec 06, 2010 at 07:50 AM

It's a triple question in one sentence. Pretty impressive.

1: Moving Objects 2: Randomizing paramaters 3: Following waypoints

1: Use character controller Move, Physical Force, or changing the transform values or using a method in the transform class 1 , 2

2: This is how you make a random value

3: I have no idea how to do this in Unity or if there is a support system for it. My best guess would be setting up a container with Vector3 values such as an array or list.

This is a suggested approach.

Create some Vector3's using 3 random values per Vector. Make a fixed amount of vectors Store them in an array or other datatype for containment.

Write a method for sorting everything over a set of axes in which you can pick any Vector with random value as long as it's values are closes to the target position than the current position. And if the vector is not a correct one to pick , remove it from the options list/container for the next move and pick again.

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 yoyo · Dec 07, 2010 at 09:44 PM 1
Share

See also A* search algorithms, if and when you want your "random" movement to be deliberate and sensible (obstacle avoidance, etc.) $$anonymous$$ore info on wikipedia ... http://en.wikipedia.org/wiki/A_star

avatar image Proclyon · Dec 08, 2010 at 07:43 AM 0
Share

A* star is more often used to get the best path ins$$anonymous$$d of a random one as far as I know. But it should be possible depending on your implementation. But seeing as the scope of the question is pretty much as defined as a global template your comment is quite valid.

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

No one has followed this question yet.

Related Questions

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

fixed distance for Vector3.moveTowards ? 1 Answer

Random Movement : 2d 1 Answer

How to allow movement of game object to certain points only 1 Answer

Need help with Flashlight Script 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