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 Johan 4 · Mar 22, 2011 at 09:26 PM · cameramove

Moving an object in camera direction?

I have a camera that rotates around an object and I want the object to move forward as to where the camera is looking. Can't really think of a way to do it, any tips?

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 DaveA · Mar 22, 2011 at 10:17 PM

Camera.main.transform.forward is where it's looking. You could translate your object along the negative of that, or move the camera forward.

Comment
Add comment · Show 4 · 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 Johan 4 · Mar 23, 2011 at 03:01 AM 0
Share

No idea how to use this at all. It outputs something from 0 to 1 and I have no idea how to move my object in that...

avatar image DaveA · Mar 23, 2011 at 03:13 AM 0
Share

That's 'normalized' direction. If you multiply that vector by a number (where 1 = 1 meter), it will give you that distance in that direction.

Actually for you, you might want to subtract the object's transform.postion from the Camera.main.transform.position, then normalize that, to get the direction from the object's origin to the camera. Then multiply that normalized vector by the amount you want to use and add that vector back to the object's transform.position (or call transform.Translate())

avatar image Johan 4 · Mar 23, 2011 at 03:22 AM 0
Share

This gives me forward in rotation and position which breaks stuff and makes forward not forward and whatnot. If I try transform.position.forward, it complains about some not access stuff.

avatar image Johan 4 · Mar 23, 2011 at 03:24 AM 0
Share

Using this camera view angle seems to affect the move speed because it also takes rotation into consideration.

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

camera move on unity 1 Answer

how to make camera to center the dynamically placed objects? 1 Answer

show a camera in one monitor and another camera in another monitor 1 Answer

Can you help me understand this Camera calibration between Kinect and PS Move? 2 Answers

Top-Down Camera Trouble 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