So I am going to make a game for my bachelor's degree project.
We are 3 people, all programmers, who will be making a game together in Unity.
The game will be a 3d/2d top down dungeon type game with networked multiplayer (my bachelor's degree is in Networking)
Today I started a bit prematurely, so I can get the basics working. The plan is to avoid any wasted work, like: "Oh you did that, well the collisions need to work like this so you have to rewrite everything".
And that brings me to my first topic: Collisions.
We decided not to use the built-in physics in Unity to reduce complexity. This also gives us the ability to ignore object syncing, one of the more shaky features of the built-in networking of Unity, Raknet. We may still use local client-only non-interactive physics for things like explosions.
I now have working 2d collisions, and objects will stop at the correct spots reliably. This movement is seated in the "Update()" function of Monobehaviour, which runs once every frame.
I have generalized the collision checker into a script called "CharacterMover", anything that needs collision checking can attach the script to its main transform, and then move using the Move() function.
Here is an example of a cube attempting to pass through a wall. The green lines are the general directions it is attempting to move in, through the wall and to the left. The blue lines are the counteracting vectors, removing only the components that are attempting to move the cube through the wall. This works at all angles. Here is a normal wall:
And a simple corner:
No comments:
Post a Comment