Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Mar 25, 2015 at 04:08 AM by alok-kr-029 for the following reason:

solved

avatar image
0
Question by alok-kr-029 · Mar 23, 2015 at 12:19 PM · anglecalculationmousedrag

Mouse drag get angle

I have a gameobject If i drag it to any direction I want to get the angle in update without my mouse button up, eg If I drag it to left - 180 , else if right 0 , i drag it in any angle it must give the angle accordingly ,

Nothing is comming in my head

basically I have a curvy path I have to drag the car along the path with mouse and car rotate according to the path with polygon collider,I am able to drag the car along the curve but now i have to rotate it according to curve

any help

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 Baste · Mar 23, 2015 at 02:06 PM 0
Share

You've got Event.current.delta, which gives you the mouse movement as a Vector2, which represents pixels moved on the screen. It shouldn't take too much maths to figure out the angle that vector represents.

avatar image alok-kr-029 · Mar 24, 2015 at 09:08 AM 0
Share

I am also trying somthing like that I dont know much about Event.current.delta can you explain how can i get the anglebased on the mouse movement wrt any thing Does event.current .delta applicable only for GUI as I am usnig sprites

1 Reply

  • Sort: 
avatar image
0

Answer by suchoparek · Mar 23, 2015 at 03:37 PM

If I have understood correctly, you need to rotate the car accordingly to the path. You could add an empty gameobject just before the car and use Quaternion.LookRotation to make the car look at it.

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 alok-kr-029 · Mar 25, 2015 at 04:06 AM 0
Share

Thanx I solved it by making the gameobject follow my mouse pointer and and used lookat2d

Follow this Question

Answers Answers and Comments

23 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 avatar image

Related Questions

Mouse drag with specific angle 1 Answer

Angle calculation not working?? 2 Answers

Angle between vectors - calculation 2 Answers

Worng SignedAngle 0 Answers

Math Genius NEEDED! Algorithm problem with parabola 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