Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question How to keep a simulated character on inside a accelerating/rotating aircraft

Discussion in 'Physics' started by Duck_With_Grape, Jan 12, 2024.

  1. Duck_With_Grape

    Duck_With_Grape

    Joined:
    Sep 6, 2021
    Posts:
    37
    I am working on a game where players work together inside of an aircraft to evade or destroy enemy aircraft. One of the mechanics I imagined for my game was to have the players be able to walk around the aircraft to interact with different parts. Traditionally, I have worked with a physics-based movement system, and the airplanes are also physics-based, which raises some significant issues. If the aircraft rotates or changes speed even a little bit, I would imagine that the players inside are going to get pushed into some wall (and may, in admorally large or small planes, lag through the wall and fly into the outside world). What I want is for the rigid bodies to accelerate/rotate with the plane, allowing for the pilot to move the plane around while other members walk around the plane.

    I am still in the planning stage, and if there is no way to do this, then I would be totally ok with scrapping the idea or moving to a non-physics system based movement for the players and/or the plane, but figured someone smarter than me might have already solved this problem while still using rigidbodies/the default unity physics engine.
     
  2. Ambrose998800

    Ambrose998800

    Joined:
    Jun 23, 2015
    Posts:
    74
    Copy the rigidbody.velocity of the plane to the rigidbody.velocity of every character inside (to sync everything) and add movement vector to the velocity to move inside the plane.