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 CrazyEoin · Nov 27, 2012 at 03:39 PM · rigidbodyvector3sphere

Get a point trailing behind a tumbling rigidbody

I have a sphere that is fired out of a cannon and has to be followed by a camera. I am currently using a modified version of smooth follow script. My problem is that the sphere will bounce off things in the scene and will begin to tumble on all 3 axis due to collisions. When the tumbling happens the forward vector of the sphere is now not relevant to the actual forward direction of travel of the sphere, causing the camera to basically become un-viewable. How would I get the position a few units behind the sphere relevant to its current direction of travel?

I can draw a diagram to better explain this if its not totally clear? I've searched around the forums and come up with stuff but none of it takes into account the tumbling nature of the sphere. If there is a post I've over looked I'm eager to know! :)

Many thanks in advance!

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
Best Answer

Answer by CrazyEoin · Dec 06, 2012 at 01:04 AM

I finally got back to my home computer to continue work on this. Thanks for your answer Rob, you understood the question correctly but none of those suggestions did the job. I went back to basics and looked at it from scratch and got it working in the end.

I used the .normalized function of the Vector 3 and this gave me the direction of travel, after that all I needed to do was multiply this by a distance and add this to the origional position of the ball, here is my code which probably explains it better:

 Vector3 dirOfBall = Ball.rigidbody.velocity.normalized;
 dirOfBall = Ball.transform.position + ((dirOfBall * -20) + new Vector3(0,height,0));
 MainCamera.transform.position = Vector3.Lerp (MainCamera.transform.position,dirOfBall, Time.deltaTime * damping);
  

Rob, thanks for your input and I hope this is useful to anyone else stuck with this kind of problem.

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 n8 · Feb 14, 2013 at 08:07 PM 0
Share

you should mark this as answered if it indeed solved your problem

avatar image CrazyEoin · Feb 15, 2013 at 09:07 AM 0
Share

Apologies, I though I had marked this as answered. Thanks for re$$anonymous$$ding me.

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

12 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

Related Questions

sphere won't rotate when vector3.movetowards is used 1 Answer

vector3.forward doesn't work when used in Rigidbody? 2 Answers

Turning a rigidbody that's in motion 2 Answers

Can you pls help me fix this rigidbody collision problem 0 Answers

Roll a ball around with Mobile Standard Assets First Person Controls and make image look decent on sphere. 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