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 flaviusxvii · May 23, 2011 at 09:56 PM · transformoffsetforwardupadjust

Adjusting transform (up, forward, whatnot)

EDIT: My scripts work fine! My question is about proper usage of the Transform object and it's subordinate vectors. Please read carefully.


I've been writing scripts that make adjustments to some of the transform vectors. Take for instance a script that controls a missile tracking a target. I make some vectors and determine how much of an adjustment to make based on the allowed turning rate of the missile. Then I simply add the offset to transform.forward.

Does this make sense? Should I be using the Rotate method or Quaternions instead of this kind of direct modification?

Things seem to be working properly but does Transform automatically normalize and fix the other direction vectors when you modify one?

Comment
Add comment · Show 13
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 flaviusxvii · May 24, 2011 at 09:40 PM 0
Share

Why would anyone downvote this?

avatar image GesterX · May 24, 2011 at 09:46 PM 0
Share

If people are going to downvote something - at least give a reason so the asker knows what they've done...

avatar image Byterunner · May 24, 2011 at 09:54 PM 0
Share

I'm not sure I understand what you're asking. Are you making modifications to the standard Vector3.up, Vector3.forward, etc.? As in Vector3.up = Vector3(0.53, 0.89, 0.1); and stuff like that? I didn't think that was possible, but that could just be my assumption because I'd never want to actually change them.

avatar image UniteMage · May 24, 2011 at 10:12 PM 0
Share

It sound like you want to have a smart missile that tracks the position of your target. A lot of player type aircraft uses evasive maneuvers thus avoiding missiles. Simply set your positional coordinate values of the missile incrementally towards that of your target.

Thanks CSDG

avatar image flaviusxvii · May 24, 2011 at 10:27 PM 0
Share

@Byterunner.. No, I'm not changing the standard 'forward'. I'm changing gameObject.transform.forward. And it works, but I've never seen a reference to it so I'm wondering if that is crazy or not.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
-1

Answer by UniteMage · May 24, 2011 at 10:22 PM

Basic Chasing and Evading

 if (missleX > targetX) missleX--;
 if (missleX < targetX) missleX++;

Do the same for the other axes. Of course this is an over simplification.

Thanks CSDG

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 Joshua · May 24, 2011 at 10:27 PM 0
Share

http://www.gotow.net/andrew/blog/?page_id=78 take a look at the AI for steering left/right. It's a very good system. Simply calculate the relative position and apply steering based on it.

avatar image flaviusxvii · May 24, 2011 at 10:28 PM 0
Share

$$anonymous$$y tracking scripts work fine. $$anonymous$$y question was about the validity of directly modifying gameObject.transform.forward.. on the missile itself.

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

2 People are following this question.

avatar image avatar image

Related Questions

Draw lines with Vectrosity in the direction transform.forward 1 Answer

Moving game objects 2 Answers

How to anticipate the Vector3.forward of the enemy? 1 Answer

Problems with Vector3.angle and angle to target 1 Answer

Get a vector3 for 'transform.backward' 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