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 Gabrieldonley · Nov 27, 2015 at 10:25 AM · torque

Can someone help me slow this object down?

Hi there, So I mastered the code of making an object(my helicopter) fly across the screen, but it's at vector speed 1 which is excruciatingly fast. I add a 0.3 decimal to slow down the object, but it says that the '*' sign is invalid and can not be doubled or something like that. Could someone please help with this? Thanks! Gabriel

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 fffMalzbier · Nov 26, 2015 at 11:42 AM 0
Share

Please insert the code and the exact error message you get to help find the error.

avatar image Gabrieldonley · Nov 26, 2015 at 01:08 PM 0
Share

Ok, here is the line of code I'm working with: transform.Translate(Vector3.left * 1); And here is the error message: Assets/Scripts/Enemy$$anonymous$$ovement.cs(13,45): error CS0019: Operator *' cannot be applied to operands of type UnityEngine.Vector3' and `double'

Thanks for your help!

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by fffMalzbier · Nov 27, 2015 at 10:31 AM

You can not multiply a Vector3 with a value of type double. You have to declare the value as a float if you use a comma value.

     Vector3 test;
     test = Vector3.up * 1; //integer  -> Does work.
     test = Vector3.up * 0.3;//double  -> Does not work. will produce CS0019
     test = Vector3.up * 0.3f; //float -> Does work.
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 Gabrieldonley · Nov 27, 2015 at 08:10 PM 0
Share

Thank you so much!! That worked perfect. Just one last thing. Do you know how I can randomize the number of enemies that come from off-screen? I want to be able to make a certain amount fly out just like a fast-action scrolling game. Thanks

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Nose Diving Plane 1 Answer

Moving a rigid body on a plane applying forces 1 Answer

How to make 2d Vehicle/car physics in unity 3d 4.3 2d physics? 1 Answer

using torque to alighn an object with surface 0 Answers

Can I, someway, avoid centripetal force? 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