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 JohnRossitter · Jan 08, 2014 at 04:50 AM · roll a ballcharacter controlling

AddForce relative to camera rotation

Hi Unity,

I'm not a complete newb, but I'm really stumped by this one. I have a game that uses a 3rd person controller and smooth follow camera script. The net effect, it that I have a world my character plays in that is full 3d, but the camera stays in sync with the character on his X & Y axis(NON ORBITING). In addition to this, I have a 2nd player on the screen who acts as a rover (rolling ball) who operates independently from the main character. My 2nd player is typically controlled by the right analog joystick of a PS3 or XBOX Controller. The control is driven by calling rigidbody.AddForce() on the ball itself. My problem arises when my levels do not have strict X & Y level design applied to them. It seems that rigidbody.AddForce() is relative to world coordinates and not current input direction.

Ideally, I would like to call AddRelativeForce based off of the the current camera rotation, but I'm really struggling with how to do that.

Anyone else ever have a situation like this?

Thanks,

John

Comment
Add comment · Show 1
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 robertbu · Jan 08, 2014 at 04:53 AM 0
Share

I cannot visualize your setup. You say the camera follows on the X & Y (NON ORBITING), which implies there is no camera rotation, but you write of using the camera's rotation for adding your force. I think you need a diagram, or a short video, or something to demonstrate the setup. The solution is probably easy once the setup is clear.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by iwaldrop · Jan 08, 2014 at 05:04 AM

You didn't post any code, and I agree with robertbu that it is difficult to tell exactly what you mean, but I think I may understand you, and it seems pretty simple. Use Camera.main.transform.left or its inverse instead of Vector3.left.

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 JohnRossitter · Jan 08, 2014 at 06:16 AM 0
Share

That worked for me, Thanks!

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

20 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

Related Questions

Using First Person Controller with networking causing problems 1 Answer

Unity 4.3.4 completely freezes with third person script 0 Answers

How to create a Input control like "fast like a fox " game 0 Answers

Restrict Scaling of Object due to camera position and angle. 1 Answer

Roll-A-Ball Tutorial public float speed 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