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 skuGen · Apr 30, 2013 at 06:05 PM · errororientationlookatmouse

LookAtMouse wrong orientation

Hello, I am new to programming and Unity, and have been trying to use the LookAtMouse script. The script itself works as it should, the only problem is that when i Play in editor the orientation of the turret that have the script changes.

I have been searching alot trying to find something similar to this, but witouth any luck.

here are pics to show:

http://skugen.wordpress.com/2013/04/30/lookatmouse-problems-pic-ref/

top left picture shows the ingame orientation of turret, it follows the mouse as it should, but points downwards instead of forward.

top right pic shows the original mesh in prefab.

Bottom pic shows orientation in editor.

It looks like the LookAtMouse script sets the turrets orientation back to its original imported orientation(tried changing orientation in 3ds Max, and tried Z-axis/Y-Axis as up, witouth any changes in the original imported orientations.

Any ideas or pointers to what can cause this and how to fix?

Any help will be much appreciated!

regards, skuGen

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
0

Answer by robertbu · Apr 30, 2013 at 06:50 PM

LookAt() scripts almost always point the positive 'Z' side of the object at the position/direction specified. I'm not sure which LookAtMouse script you are talking about. I posted a very simple one awhile ago. In a third-person, 3D, turret-type environment you are likely to need someone more complex.

One solution to your problem is to make your Turret a child of an empty game object.

  • Rotate your turret to the position orientation you want with the gun barrel pointing to towards positive Z.

  • Create an empty game object and place it at the pivot point of the turret.

  • Make the turret a child of the empty game object.

  • Attach the script to the empty game object.

Comment
Add comment · 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
0

Answer by skuGen · Apr 30, 2013 at 07:38 PM

Thank you for fast answer robertbu!

I found a solution myself just now, that I did not think of first.

By changing the pivotpoint in 3ds max, I rotated the pivot point to counter the rotation that occured while playing it. with the pivotpoint now changed(Y rotated to become Z in 3ds max) it now faces the way it was intendeed to.

Comment
Add comment · 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

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

12 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

Related Questions

How to fix "Assertion failed: dynamic_array" error on scriptable objects? 0 Answers

Weird game-output! 1 Answer

BurgZurgArcade Tutorial 3 Answers

The type or namespace "Target" could not be found? 1 Answer

Unable to create android .apk with SDK revison 23 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