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 PiMuRho · Jun 27, 2012 at 12:21 PM · spaceflight

Space fighter banking

I've seen similar questions asked before, but they're all about making a fighter bank based on player input. I'm trying to make my enemy fighters bank. Here's what I've got so far:

     var relativePos = fightertarget.position - transform.position;
 var fighterRotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation(relativePos), TurnRate * Time.deltaTime);
 
 //banking on turns! Somehow!
 
 
 transform.rotation = fighterRotation ;
 transform.Translate(Vector3.forward *0.1);

Which is pretty much a basic homing script. I can't really get my head round Quaternions (yet) so it's kicking my backside. I've tried numerous different approaches, but nothing has worked so far.

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 thojoh370 · Jun 03, 2013 at 02:18 PM 0
Share

Shame you didn't get any answers to this, but I'm still curious how far did you got with this? And I assume you made them move towards the player somehow (AI), did you find an effective method of doing that?

avatar image PiMuRho · Jun 06, 2013 at 10:11 AM 0
Share

I didn't really get any further with it. I prioritised working on other aspects with a view to getting back to this later on. I'm getting there slowly :)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Jujo100 · Jun 04, 2013 at 12:14 AM

Couldn't you just rotate the enemy around it's local Z axis based on the TurnRate? You can use this http://docs.unity3d.com/Documentation/ScriptReference/Transform.Rotate.html which defaults to local space if you leave out the last parameter.

To determine which way to bank. You would need to know if the player is on the left or right of the enemy. Someone has explained how to do this here : http://answers.unity3d.com/questions/13033/how-to-determine-if-enemy-is-on-my-left-or-right-h.html

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 PiMuRho · Jun 06, 2013 at 10:11 AM 0
Share

That's actually potentially quite useful. Thanks for that, I'll give it a go.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Smooth Space Flight Script 1 Answer

How do I use the mouse to control a spacecraft like in this game? 1 Answer

Unity mouse trackball? (i guess it is called that) (c#) 1 Answer

Fly-By-Wire System 0 Answers

Space Flight 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