- Home /
2 2D Physics Rooms/Worlds
Hi, i want to make a Top-Down Space Game with a Player in a Spaceship. The Player can walk in the ship and for example controll it by using a monitoring desk. So i want 1 physics Room/world for the inner Ship and 1 physics Room/world for the universe so that the Players or the Enemys IN the ship have nothing to do with the Ships movements.
Is that possible?
Answer by Spinnernicholas · Dec 04, 2013 at 04:18 PM
Yes, by using layers, you can change effectively create two or more separate physics areas.
You would have layers for the "ship space".
And separate layers for the "universe space".
Then, in the physics options, you would set which layers interact.
The only thing that you can't separate is gravity. I'm assuming you won't have any gravity while on the ship, so you can set the local gravity for rigidbodies in "ship space" to 0. Then, setting the gravity will effect only things in "Universe Space".
$$anonymous$$ake everything on the ship, including the player a child of the ship.
Create a new gameobject to represent the inside of the ship. It will be separate from and not a child of the gameobject that represents the ship as a whole. Then write a script that manually positions it with the outside of the ship.
[1]: http://docs.unity3d.com/Documentation/Components/class-FixedJoint.html
I know that... but what if i have some players, bullets and enemys with physic?
Answer by Zerod · Dec 04, 2013 at 05:18 PM
The problem is that the ship has a BoxCollider2D with Rigidbody2D and the player too, now if the ship moves the player collider stays where it has started... does anyone know why or a work around?
PS: the player and ship are on different uncolliding layers.
Your answer
Follow this Question
Related Questions
How to run a script every time a scene is loaded. 0 Answers
Sprite rendering problem 0 Answers
2d physics problem 1 Answer
New Pointer Effector 2D Help 0 Answers
2-d game creation code help 1 Answer