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 darthbator · Jun 17, 2013 at 06:05 PM · physicsthrow

Accurately lob an object at a target

So let me lead by saying that my math is not exactly my most powerful skill. I've done a little bit of googling and haven't really found a good solution for how to accurately lob an object at a stationary target using the physics system. I've seen people resort to tweening the object in order to get a behavior like this. However before I just gave up and decided to use a tweening solution I figured I would post a question and ask how one would go about doing something like this using the built in physics system?

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
1

Answer by AntiLunchBox · Jun 17, 2013 at 07:06 PM

If you are using a kinematic rigidbody that isn't effected by gravity, you can use the quadratic Bezier Curve equation

You just have to convert it to code, which isn't bad. I'm pretty sure you can google some Bezier Curve function in c# or something. Basically you choose the start point, destination point, and a height point. And just plug in 't', which is between 0 and 1. When t is 0, you'll be at the start point. When t is 1, you'll be at your destination.

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 darthbator · Jun 17, 2013 at 08:11 PM 0
Share

Interesting! Thanks I'll totally try that! Is there a way to factor gravity into this? How would the bezier curve work with physics? Would I still be basically tweening the object to the destination or is there a way to propel it with a physics force?

avatar image AntiLunchBox · Jun 17, 2013 at 08:27 PM 0
Share

No, $$anonymous$$inematic Rigidbodys are not affected by gravity, forces, or collisions. You can simulate that by lowering the height point in your bezier curve(for gravity), and increasing the speed at which 't' changes (force). But, $$anonymous$$inematic Rigidbodys will interact with other non-$$anonymous$$inematic Rigidbodies. HOWEVER, if you want to use gravity/force on this thing--you can turn off kinematic LATER if you want it to be affected by gravity when you are NOT lobbing it. Or if it gets hit in the middle of a lob, then turn off is$$anonymous$$inematic and then apply the force.

avatar image darthbator · Jun 17, 2013 at 10:11 PM 0
Share

Will a kinematic body detect collisions? I need to know when this thing hits the floor. I'm cool with not moving the object with physics forces as long as I can still use the built in collision events to act on it.

avatar image AntiLunchBox · Jun 18, 2013 at 03:00 AM 0
Share

yes, as long is the floor is not kinematic. Check out the Collision Action $$anonymous$$atrix at the bottom of the page.

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

15 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

Related Questions

Can I fake physics? 1 Answer

Kinect character throwing ball using Physics 1 Answer

How to drag and throw 2D objects?(SOLVED) 5 Answers

ObjectSpawner 1 Answer

Throwing object with force 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