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 /
avatar image
1
Question by BlueExtremeGames · Mar 01, 2013 at 01:42 AM · objectrotatepoint

rotate the object based on the two-point

schema

Hi friends, I want to return a specific object, but somehow I could not find by two points. I'd appreciate if you help, thank you :)

teqer.png (19.2 kB)
Comment
Add comment · Show 3
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 Owen-Reynolds · Mar 01, 2013 at 06:35 AM 0
Share

Do you want to rotate (as in the heading) or find&return an object (in your text below)?

Is this for a touchscreen, where the two points are two touches?

avatar image BlueExtremeGames · Mar 01, 2013 at 09:25 AM 0
Share

I'm a fake car physics

alt text

When the wheels up, according to him must return the red-colored boxes.

teqer.png (180.0 kB)
avatar image The-IT664 · Mar 03, 2013 at 08:45 PM 0
Share

Not sure if this will help but if you want to implement car physics it's probably best to stick with the existing WheelCollider classes or take a look at this: http://wiki.unity3d.com/index.php/WheelColliderSource

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by kittenkong · Mar 13, 2013 at 09:46 AM

I struggled with this for ages and finally found a solution.

First move your object to the center point of the two points

 transform.position = (p1 + p2)/2.0;

then align your object between the two points

 transform.rotation = Quaternion.LookRotation(p1 - p2, Vector3.forward);

Thats it, too easy.

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 Akravator · Aug 12, 2020 at 08:49 AM 0
Share

Sorry to resurrect this thread, but is it possible to use Joint ?

avatar image Owen-Reynolds Akravator · Aug 12, 2020 at 01:42 PM 0
Share

You can put a joint between 2 objects and adjust the settings, but it's difficult to tell a joint "now I want you to go to X degrees". They're best when you want something to move like a real-world connection, but don't care exactly how.

avatar image
0

Answer by The-IT664 · Mar 01, 2013 at 04:07 AM

Seems like what you want to do is find the mid point between the two contact positions then rotate about the mid point.

You should be able to do this through transform parenting, though it's not entirely trivial.

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

13 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

Related Questions

Rotation to certain degrees while holding a button? C# 1 Answer

Follow object by Transform.Rotate 1 Answer

Rotation of my enemy How?? 2 Answers

rotate the object only 360degree for once 2 Answers

How to get an object to turn around/flip at a certain point 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