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 selonella · May 16, 2015 at 05:15 PM · rotaterotate object

How can I rotate a 3d object along a direction?

I have an object and I want to rotate it when a Vector3 point's position is changed. Another Vector3's position is always same. I have this code where finish and starts are transformation objecits and finish is updated according to user's input:

 Vector3 dir =  finish.transform.position - start.transform.position;
 obj.transform.rotation = Quaternion.Lerp ( obj.transform.rotation,(Quaternion.LookRotation(dir) ),Time.deltaTime*10);


But this does not work correctly what could be the reason?

Comment
Add comment · Show 5
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 AlwaysSunny · May 16, 2015 at 02:13 PM 0
Share

In what way does this not work correctly? Are you aware of the LookRotation() overload which takes a "normal" axis parameter? Without this overload, certain desired characteristics may not be met.

avatar image selonella · May 16, 2015 at 03:57 PM 0
Share

I control the object which is 3d flashlight object with mouse in the running mode. And I want to rotate the flashlight along with a direction acording to the changed position. For example if I move the object to the right I want to rotate this flashlight to the screen.

avatar image AlwaysSunny · May 16, 2015 at 04:07 PM 0
Share

Your language does not communicate anything meaningful. You could mean any number of things by each of the subjects and predicates in your comment. You must take great care to communicate effectively here. Better nouns, verbs, descriptions, and proper jargon.

You are creating a vector pointing from start to finish, and telling the object to rotate to face the direction specified by that vector.

What is your intention, or how do you expect this to behave differently?

$$anonymous$$y comment should've included a link to the LookRotation documentation page. You will notice there is an overloaded version which takes a second argument, an "up" direction. Perhaps this is what you need to learn and use. I don't know that for certain, because I'm still not clear on your situation or what's wrong.

avatar image selonella · May 16, 2015 at 04:26 PM 0
Share

I edited my first comment and try to be more clear, sorry for inconvenience

avatar image AlwaysSunny · May 16, 2015 at 05:15 PM 0
Share

I still don't understand the problem at all. If we can't understand a question, we're not supposed to approve it, but maybe someone else will grasp your meaning.

You need to be much more careful when attempting to describe your scenario. I have even less understanding of what you need now than I did before.

I recognize there is a language barrier if English is not your first language. However, there are words and phrases you are using which could mean multiple things in different circumstances. Without understanding your situation and goals, we cannot offer any assistance. Sometimes diagrams can help. I do not understand what this screenshot is trying to communicate.

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to rotate an object once? 2 Answers

What´s wrong with my rotation function? 0 Answers

How do I rotate an object in relation to the camera?,How do I rotate a sprite in relation to the camera? 2 Answers

Translate to a distance then rotate and go back to earlier position on x-axis 0 Answers

Rigidbody rotation problem 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