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 /
This question was closed Oct 20, 2013 at 07:20 AM by clunk47 for the following reason:

OP Insulting those who choose to help.

avatar image
-1
Question by knuckles209cp · Oct 18, 2013 at 09:59 PM · quaternion

Cannot convert 'UnityEngine.Quaternion' to 'UnityEngine.Transform'.

So someone gave me this script and he told me that there would be errors because he did it in a hurry .

var shaking : boolean = false;

var OriginalRotation : Transform;

 function Update (){
 
     var camera = GameObject.Find("MainCamera");
     OriginalRotation=camera.transform.rotation;  **// THIS LINE**
 
     OriginalRotation; **// AND THIS LINE** 
     GameObject.Find("ump").animation.Play("ShootUMP");
     if(!shaking){
           CamShake ();
      
      }

thats not the enitire script though , it was just a add on . Im new to scripting thanks

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

  • Sort: 
avatar image
3
Best Answer

Answer by meat5000 · Oct 18, 2013 at 10:02 PM

I'm guessing OriginalRotation is a Transform. It should probably be a Quaternion.

Comment
Add comment · Show 9 · 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 flaviusxvii · Oct 18, 2013 at 10:08 PM 5
Share

You can't use this site and a line-by-line error message translator. Stop copy/pasting code you don't understand. Go do some tutorials.

avatar image Huacanacha · Oct 18, 2013 at 10:18 PM 2
Share

He has a point, even if he expressed it tersely.

You should really check the docs first before asking this sort of basic help: http://docs.unity3d.com/Documentation/ScriptReference/Camera.html http://docs.unity3d.com/Documentation/ScriptReference/Animation.html

There is no animation method on Camera that takes a parameter, but you can lookup animation states using array style [] indexing. Change it to camera.animation["CameraShake"].length.

avatar image Huacanacha · Oct 18, 2013 at 11:46 PM 4
Share

You're welcome! I'm so glad I spent my time solving your problems and pointing you in the right direction. Lesson learned.

avatar image meat5000 ♦ · Oct 20, 2013 at 07:20 AM 1
Share

How about some thumbs up for the guy that actually threw an answer? :D

It's like an old mothers' meeting!

Edit : Respect :P Thanks

avatar image YoungDeveloper · Oct 20, 2013 at 07:28 AM 3
Share

@clunk47 It's actually not the first time that guy is being a totally ungrateful douche bag.

Show more comments
avatar image
2

Answer by Huacanacha · Oct 18, 2013 at 10:14 PM

Change:

 var OriginalRotation : Transform;

To this:

 var OriginalRotation : Quaternion;

Transform.rotation returns a Quaternion, but your variable is a Transform type.

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 Huacanacha · Oct 18, 2013 at 10:21 PM 0
Share

See my answer in the other comment... use camera.animation["CameraShake"].length

avatar image knuckles209cp · Oct 21, 2013 at 08:03 AM 0
Share

thank you.

Follow this Question

Answers Answers and Comments

20 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

Related Questions

How to do relativte offset rotation 0 Answers

Get my head around Unity Rotations 1 Answer

Rotation direction in coroutine 2 Answers

2D look at 1 Answer

Efficiency of transform.forward, up, and right 2 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