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 tonypee · Apr 13, 2011 at 11:24 AM · rotateangle

Rotate an angle

I want to rotate an angle in the local space (kinda).. ill explain.

So i am firing an object out of an cannon (original i know) - but the transform.forward of the cylinder faces down at the ground.

If i do:

c.localEulerAngles.x -= 90;

rigidbody.AddForce(c.forward*powerValue*200);

c.localEulerAngles.x += 90;

I get my desired result. I would like to know the (non hack) way to do this properly.

cheers Tony

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Jean-Fabre · Apr 13, 2011 at 11:36 AM

Hi,

Simply use either c.up or c.right instead of c.forward. If fired in the wrong direction, use then -c.up or -c.right.

That then should work properly without any hack.

Bye,

Jean

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 tonypee · Apr 13, 2011 at 11:43 AM 0
Share

Good thinking. Also, Just say i want to change it by a smaller value - eg. 25degrees. I am interested to know if there are helper functions. I was thinking Vector3.rotate, or do i multiply the vector by another? just wondering, as i'm sure i might need to do this in the future

avatar image Jean-Fabre · Apr 13, 2011 at 12:23 PM 0
Share

ins$$anonymous$$d of using c as the base to define the force direction, use another transform, like the transform of the canon. Else position and rotate your bullet properly before firing. $$anonymous$$aybe I misunderstand your question tho.

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

No one has followed this question yet.

Related Questions

Rotate camera to character angle 0 Answers

How to rotate a dice to a final angle ? 1 Answer

Camera rotation around player while following. 6 Answers

Rotate an Object based on shorter angle 1 Answer

How to rotate an object along the Y axis to the right, and then to the left? 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