Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Thex_PiedDroit · Nov 01, 2015 at 11:11 PM · physicsaddforceforcesinertia

How to make a convincing ground inertia?

Hi there!

Here's my situation: I am making a game which involves the player being on a train moving really really fast. The problem is that the game is based upon the movements of the train, which does loops, barrel rolls and stuff and the player has to not fall out of it, so i can't just fake the trains movements by moving the outside set instead.

Now the issue i'm having, as you read the title, is that i cannot, for the love of me, find a way to do a convincing (nor even working and "universal") inertia for the player. I mean i first wanted to make the character's world moves always affected by the ground's moves (by applying the ground's speed or anything every frame) but it turned out lame and not working at all, so i decided to parent the player to the ground, and unparent it every time he wasn't on the ground, and only then apply a force in the direction the ground was going. That also turned out not working at all, because of the huge speed of the ground and the inaccuracy of the addforce; making it, at best, landing back or forth of the position he jumped from, and having to find the exactly accurate multiplier for the impulse force, which was something around 200.000 or something, which is stupid. So another way i thought about was to add a ground "tracker" at the player's feet and parent that to the ground instead of the player, make the player follow its x and z values when on the ground (not the y, to make it possible for the ground to suddenly go down, making the player "hover" and start falling, which would be awesome), but then again, adding a force when jumping wasn't an option, so keep the ground tracker on the ground as long as the ground isn't too far below the player (an arbitrary serialized value), and then only add an impulse to simulate an inertia.

With this solution, not only is the impulse not working again (cause having to multiply the ground "speed" (calculated by subtracting the last frame's ground's position by the current one) by a huge value for some reason i don't even understand anymore, and because the train's ground might have some holes in it that the player should be able to jump over without being counted as "falling"). The other problem being that the entire game's based on a grappling the player uses to move around the train (zelda-like grappling (attracting, not swinging)), so theorically the player would be in the air most of the time so..

Anyway so, after litterally one month of attempts and failures, i'm starting to feel really tired of this problem and i'm beginning to lose any understanding i have about anything, about how the unity physics works exactly (the addforce never works exactly as i intend for example), and i'm running out of ideas on how to make that damned inertia, so i'm turning to you to see if you would have any idea on how to make this thing work please?

Here is a quick video to show the game and how it works, so you can see my problem more clearly i hope: https://youtu.be/M2kNcnQ2c9M

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

Answer by NotEvenTrying · Sep 09, 2017 at 06:26 AM

A rather late reply since I'm only seeing this now, but you only need to rely on the physics systems already in place within unity. If you have friction between the player and the train, the player should move along with the train. Looking at the video, the problem is not that the player doesn't appear to be moving with the train, but that the train is accelerating unrealistically fast, so its only natural that the player would fall off (try pulling out a sheet of paper from underneath an object slowly, and then really really quickly, and you'll see what I mean). Also keep in mind that while the train is moving at a constant velocity, the player would realistically see the train as stationary from their point of view due to relativity. If you're looking to have unrealistic, wild movements on the train, then you will need to adjust things such as gravity, friction and whatnot appropriately in order to keep the player on the train.

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

39 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 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

Ball Speed is not increasing as per code 0 Answers

How do I get objects in front of the player to be blasted away? 1 Answer

Physics-related touch input (Continuous) 0 Answers

Read force/pressure applied to a fixed RigidBody 2 Answers

How can I find a point on a collider that is closest to my player. 0 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