- Home /
How to realize a moving, rotating Spaceship with a moving player with top down view ? 2D
Hi. I need ship, where player can move with top down view. This ship moves with it's own script, player too, independently. Player should "stick" to the ship. If he is just a child obj of the ship, he will fly away from the ship and is affected by the ship's movement, which is not what I want. I have found 2 ways of doing this. 1) - script is on playerObject
public Transform HoldingObject; //ship
public Transform PlayerObject;
void Start()
{
}
void Update()
{
PlayerObject.position = HoldingObject.position;
PlayerObject.parent = HoldingObject;
}
The problem is that the player cant move inside the ship, since his position is always matching the ship's position.
2) - Make a script that makes playerObject isKinematic. This way, player is not affected by the physics of the ship and as a parent object of the ship, it stays on top of it. The problem is that I dont know what kind of limitations will this bring. If the transform position based movement for isKinematic PlayerObject is a good idea. Will I be able to make a collision with the walls then ? Is the movement gonna be like teleportation or can I make it somewhat natural ? If so, can you give me a glimpse of such script ? Thank you very much.
Your answer
Follow this Question
Related Questions
How to make a 2D Player move a box properly ? 1 Answer
How to make slippery/smooth movement in Unity 2D? 3 Answers
Character instantly jumps instead of smoothly gaining altitude 3 Answers
Instantiate new gameobjects on collision, keeping velocity, up to a cap 1 Answer
2D Rubber hands (Weird question) 1 Answer