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
1
Question by Srch · May 28, 2010 at 09:37 AM · aisteeringunitysteer

Robot Simulation

I'm trying to use Unity Steer for an MSC project:

My project consists of a flat arena, with cylindrical obstacles, and an AI controlled "Robot".

The player will be able to move on this arena as first person controller, upon mouse click or a key press, an object "food" will be instantiated in front of the player.

The Robot should be idle until a "player proximity" event is triggered, upon which it will wander, avoiding obstacles.

If an instantiated object "food" is present on the scene, the robot will move to target on it, while still avoiding obstacles. The food will disappear after a number of seconds, re-triggering wander. If no more "food" is spawned within a time limit, the robot will tether to base and go idle again. The classic cat and food scenario.

I have the individual behaviors working, with move to point, and wander radar behaviors. I need to merge the two of them, possibly with some form of state machine or behavior tree triggering either of them according to the state of the scene, as I have animation for wheels turning, turning, eat, and waggle tail to be triggered as well depending on state.

I noticed that placing both scripts on the robot component makes the obstacle avoidance brake, even if one of the two scripts is inactive.

I assume I need to write my own behavior and vehicle script, that merges the Arrive and Wander, implementing radar as well, finding this rather difficult.

my question is:

1)What is the best approach to switch between two behaviors/vehicles, do I need to write a new behavior that merges wander and arrive?

2)How do I make the robot look for an object at run-time, currently target is set on awake.

sorry for two questions in one, feel free to edit :)

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 Cyclops · May 28, 2010 at 02:09 PM 0
Share

@Srch, please help out the site by upvoting good answers (to any question), and checkmarking the best Answer to a Question you asked. Even if people don't like a particular Answer (say the answer is, "not possible"), if it's the right/best Answer, it should still be checkmarked. Note that you can always switch checkmarks if someone does come up with a better Answer later.

1 Reply

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

Answer by Ricardo · May 28, 2010 at 10:21 AM

it sounds like you'll be better served by building your own custom vehicle. Since steering is very much dependent on the game, UnitySteer was meant as a collection of steering functions, not ready-to-wear behaviors, and the others are there mostly as examples. What you want is something that alternates between MovesToPoint and Wander, always using obstacle avoidance. Look at the "Avoid Obstacles" scene for a wandering kitty that, as advertised, avoids obstacles while remaining tethered to a point in the scene.

As you mention, a state machine is an option for how to blend the behaviors, or you could also look at AngryAnt's Behave for a likely cleaner solution. I believe his example is precisely a kitten looking for food (and napping).

There are several approaches to look for an object at run-time, but it would depend greatly on how you want your robot to act. Some options:

  1. The simple case would be a random walk, where the actor simply moves from one place to the next;
  2. Have it remember the directions in which it has searched recently and give them less of a priority;
  3. Remember in which areas it found food before, and prioritize those;
  4. Remember where it has seen the player, and search in those areas, as the player is the one instantiating the food;
  5. A combination of the above.

Each approach will alter the way your robot behaves, so it depends on the effect you wish to achieve.

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 Srch · May 28, 2010 at 10:49 AM 0
Share

thanks for the quick reply, that's the part I was afraid of. The behaviors work so nice out of the tin, writing my own one is going to be more challenging, but thanks for the hint on wander tethered, looking into that now!

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

UnitySteer obstacle avoidance on non Spherical Objects 1 Answer

car movement and steering AI algorithms 2 Answers

unitysteer and path 1 Answer

Steering an AI vehicle to a waypoint using float of -1 to 1? 1 Answer

Steering using Quarternion.LookRotation. 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