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 Wes 1 · Jan 27, 2011 at 08:01 PM · enemycircle

Why are these enemies circling waypoints?

My enemies will sometimes do what their supposed to, fly to one waypoint, then, once close enough, fly to the next. But sometimes, and I cant for the life of me figure out why, they start circling a waypoint. It doesn't seam to be a specific one. Here's what I use in my script:

function movewaypoint1 () {

var rotate = Quaternion.LookRotation(point1.transform.position - transform.position); transform.rotation = Quaternion.Slerp(transform.rotation, rotate,damp * Time.deltaTime); }

the best thing I can guess is that sometimes they get thrown off track, and then they start circling it and they don't get close enough to trigger moving to the next one. But I'm not sure how to fix it.

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

Answer by AVividLight · Jan 27, 2011 at 08:06 PM

You could make the waypoints a little bigger...

Comment
Add comment · Show 4 · 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 Wes 1 · Jan 27, 2011 at 08:16 PM 0
Share

That seamed to work, which is a bit a frustrating because it seams like it should work regardless, AND I already increased the size from 1 to 5, this time I just made it 5 to 10. Thanks allot, I appreciate it.

avatar image AVividLight · Jan 27, 2011 at 08:47 PM 0
Share

Yeah, I'm glad I could help... If I come across another answer, I'll let you know.

avatar image DaveA · Jan 27, 2011 at 10:17 PM 0
Share

Had same problem. If slerp under or overshoots by a little, it will circle back. It needs to have enough 'slack' to say 'close enough, now let's move on'

avatar image Wes 1 · Jan 27, 2011 at 11:11 PM 0
Share

@ Dave, gotcha, thanks allot for the input.

avatar image
0

Answer by Jason B · Jan 27, 2011 at 11:11 PM

Sorry if I misunderstand, but could it be possible that your rotation isn't happening fast enough? I wonder if maybe you should increase the speed of your Quaternion.Slerp depending on how close to the way point you are, that way when you get really close to it, you'll be rotating extremely fast, avoiding just doing lazy donuts around it.

If you think about it, it kind of makes sense. If you turn the wheel of your car and hold it there in that exact spot (keeping your turn speed static throughout), and you try to drive onto a small circle on the ground by turning around to it, it will be impossible because even as you get closer, you're not taking tighter turns to zero in on your target.

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 Wes 1 · Jan 27, 2011 at 11:25 PM 0
Share

GBStudios already gave the answer I was looking for, thanks though :)

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

Enemy respawning after death 1 Answer

Move Objects arranged in Circle Forward 1 Answer

How to make basic AI in a 2d game? 4 Answers

Unity 3D Audio Clip Disabled 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