Search Unity

2D physics on game object made up of components

Discussion in '2D' started by MarcosPortugal, Apr 6, 2015.

  1. MarcosPortugal

    MarcosPortugal

    Joined:
    Apr 1, 2015
    Posts:
    2
    Say you want to let your users create a 2D airship (side view) made up of components. One component could be a floating balloon, another could be a storage room, etc.

    And say you want this airship to have physics applied to it as a whole, with each component playing a part in this. For example, balloons would take away from its down force and other compartments would apply down force to it.

    At the same time, the whole airship works as a whole (or at least the only physical separation would be between floater components and the others, which apply weight), so physics are applied to it as if it was one body.

    Now, how can this be managed? How can I customize a game object via a script, giving it different components with different weights, and have it behave like it was a single premade object?

    I'm sorry if the question is simple, but I'm only getting started with unity. Thank you very much!

    TL;DR: Customizable airship gameobject with different components that have different weights. How to make it behave as a single physics entity?
     
  2. Catfang007

    Catfang007

    Joined:
    May 8, 2014
    Posts:
    5
    MarcosPortugal likes this.