I am currently watching Unity’s live session about character controllers for 2D platformers and noticing a whole different approach than most of the tutorials on other websites and books. Since it is from Unity I got myself asking: Is this the best approach? Programming the whole physics for an object from scratch seems to be a bit more educational than practical… Could you guys tell me if this is the “recommended” way of doing platformers, and if so, why? Thanks.
1 Answer
1It depends on the game really and there’s not one definite best solution. There are tile based performers, running around planets, 2.5d, programmatically generated floors, you name it. If depends on the requirements. Not using Physics at all is definitely a solution. In the old days (tile based, even with slopes), there was no physics, just the necessary subset for walking, jumping, box overlap. That’s it.
This is an example script, which is sitting on your object that "Is Trigger". In this example, when you touch the object with your player, it gets teleported back to the spawn point. Void OnTriggerEnter(Collider other){ Debug.Log("Collision Happened"); other.gameObject.transform.position = spawnPoint.transform.position; } The "other.gameObject.transform.position" is your player in this case.
– KjipGamer