Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 MrFalseEye · Jul 24, 2015 at 10:48 AM · physicstouchrotatefollowpath

Need help with physics

Basically i want the player/rocket to follow a point on the screen where user touches. But It's based on physics. Force must be added when user touches somewhere and the rocket has to reach that point. Gravity is there too. If the rocket passes the point then it has to come by using forces. This is the game http://www.flashyland.com/219-jeux-flash-vol-Space-Oil.html (click the red button on the bottom left side and then green button. Arrow keys to play).

The rocket rotates too. I'm not good in physics at all.

Comment
Add comment · Show 3
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 KdRWaylander · Jul 24, 2015 at 10:53 AM 0
Share

Well, before being good or not with physics, you should post your script or what you tried to do :)

avatar image MrFalseEye · Jul 24, 2015 at 10:59 AM 0
Share

I'm totally lost. I have no idea how to approach it.

avatar image RLin · Jul 24, 2015 at 12:19 PM 0
Share

Don't just ask for a script. $$anonymous$$aybe I'll give you one if you can explain and convince me why I should be helping you ins$$anonymous$$d of doing my own projects. Explain why I should write a script specifically for you when it doesn't help me at all.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Fornoreason1000 · Jul 24, 2015 at 12:58 PM

First try to breakdown your goal into much much smaller goals. I Won't give you a script (it won't benefit you anyway), but I'll Address the steps of making one. There will be more consideration as you start coding but this will get you started on what you need to do.

First We have our input issue, we need to get our input into something usable. Touch.position is in Pixel Coordinates and our "rocket" is in World Coordinates, so we need to Convert that using Camera.ScreenToWorldPoint method.

Next is our desired Direction, this will be the Difference of the Rockets Position and the Touch position Vectors.

Next is out Angular Velocity Problem, you want it to rotates to your desired direction, or it will thrust in the wrong direction. this can be solved by adding a torque to your particular axis until its forward direction lines up with the desired direction, to stop further rotation, set the angularity to zero .

Lastly is Our Added Force Distance problem , basically we only want thrust to be applied so log there is distance between the rocket and its destination, a simple distance calculation can solve this one

Hope it helps

Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Camera rotation around player while following. 6 Answers

I want to draw a line(curved) as finger moves on screen after that move a instantited gameobject/rigidbody following that path. 2D 0 Answers

Car goes a bit left when moving 1 Answer

Compound Collider Moving Parts? 4 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