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 Grysa · Jul 09, 2014 at 02:55 PM · quaterniondirectionrotation axis

Pointing Object in the Direction it is going

Hi, Basically i have a game object "Hunter" witch fires another object "Dart" in 3 different directions, fires left ,straight and right and repeats endlessly, the problem i am having is to point that "Dart" in the direction it is going.

here is the sample i tried the LookAt and Quaternion.LookRotation with no success any help appreciated.

while (canShoot) { start = _dartInstance.transform.position; _dartInstance.transform.position = Vector3.MoveTowards(start, destination, Speed * Time.deltaTime); //_dartInstance.transform.position = Vector3.Lerp(start, destination, Speed * Time.deltaTime); _dartInstance.transform.LookAt(destination); if (start == destination) { canShoot = false; yield return null; } yield return null; }

Comment
Add comment · Show 4
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 Armand · Jul 09, 2014 at 03:09 PM 0
Share

So I understand the dart isn't pointing where you want it to, but where does it point? Does it depend on the destination, or always to the same direction?

avatar image robertbu · Jul 09, 2014 at 03:14 PM 0
Share

LookRotation() and LookAt() only work if your model is constructed so that the forward side is pointing at positive 'z' when the rotation is (0,0,0). For 3D the best fix is to change the rotation in the modeling program, though you can use an empty game object as a parent to fix the problem. For 2D, the best fix is alternate code.

avatar image Grysa · Jul 09, 2014 at 03:16 PM 0
Share

yes the dart just doesn't point in the direction it is going. it depends on the direction. so lets say the dart is fired in the +z axis, the dart goes straight then goes -3 in the x and +3 in the x, when it goes -3 or +3 it moves to that point but it doesn't not face that point if you get me.. basically the dart is facing straight when moving left or right

avatar image Grysa · Jul 09, 2014 at 03:25 PM 0
Share

robertbu, at the moment im only using a unity sphere scaled to look like a dart.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Jul 09, 2014 at 03:32 PM

Then you need to scale down the x and y sides so that the dart object points in the positive 'z' direction when the rotation is (0,0,0).

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 Grysa · Jul 09, 2014 at 03:41 PM 0
Share

Thank You! that fixed the problem!

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

22 People are following this question.

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

Related Questions

3D nested Turret Prefab Rotation 1 Answer

Rotation direction in coroutine 2 Answers

FPS camera is repositioning on both the X and Y axis, I only want the camera to slightly tilt (Z axis)...TIA! 2 Answers

How to calculate order of directions relative to world forward around point? 1 Answer

Why does the direction of the axis changes behaviour in Quaternion.AngleAxis? 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