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 Tabu · Nov 25, 2011 at 09:43 PM · physicsbullettrajectory

Calculate force applied to rigidbody to make it land at specific location

Hi I am trying to create some sort rts game, where some of the units throw stones. What I want to achieve is when the unit sees an enemy unit, it will throw a rock at it (I will calculate the precision later). So I know the distance from the throwing object to the receiving object. I can decide a specific angle it should be thrown at always. Does anyone know where to look if I want to figure out what force should be applied to the object, to make it hit its destination?

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 FLASHDENMARK · Nov 25, 2011 at 09:50 PM 1
Share

That would require complex use of mathematics. The first example on this page shows off what I think you are asking. http://itween.pixelplacement.com/examples.php

2 Replies

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

Answer by aldonaletto · Nov 26, 2011 at 04:10 AM

Forget about the force: set the velocity instead. You can choose a suitable angle, calculate the velocity and shoot: ballistic trajectory works very well in Unity. I answered a question about this some time ago, and posted a function that does all the necessary math to calculate the velocity vector - click here to read this answer.

Comment
Add comment · Show 3 · 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 Tabu · Nov 26, 2011 at 07:36 AM 0
Share

Thank you, for some reason i have missed that post after looking for someting similar. It seems to be almost what I need (the difficoult parts anyways), I will come back later and explain how I used it. Thanks.

avatar image aldonaletto · Nov 26, 2011 at 01:22 PM 0
Share

It's not a surprise that you've not found that post: I had to google a couple of times to find my own answer - and looking for "cannon ball" and my username! That question's title definitely doesn't help.

avatar image Very Little Gravitas Indeed · Jun 05, 2015 at 10:52 PM 2
Share

DEAD LIN$$anonymous$$! now it's .html, not .htm

avatar image
1

Answer by sam32x · Nov 26, 2011 at 07:21 AM

you could put and empty gameobject at the target and then put Transform.LookAt(target); on the rock and then just make the rock move forwards and it will go at the target

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 Tabu · Nov 26, 2011 at 07:39 AM 1
Share

Thanks, it seems like a usefull idea for a simple sollution.. however, I need a nice curve, this sollution will likely slam into the ground before, or make a strange curve if initial force it applied to the rock. It will reach its target no doubt, but I think this is not the entire sollution.. unless I have misunderstood what your saying completly?

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

realistic bullet trajectory 1 Answer

Calculating 3D Physics Prediction of Shot Direction with Moving target and moving gun (inertia) 1 Answer

2D projectile trajectory prediction 2 Answers

How can I show trajectory of a bouncing ball OnCollisionEnter/OnCollisionExit? 0 Answers

Why is my game not following basic rules of projectile physics? 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