Crates, as far as programming was concerned, were not actually present until we started using Panda 3d. Why? Because before that, as Andrew explained in the previous post, we were more concerned about just trying to get models to export from Maya into whatever engine we were using at the time.
Crates originally started as boxes that only the players could interact with. There was very little logic attached to them at the time. At first, crates were set to be independent of the object manipulating them. This being a player or if it was part of a stack. For instance if the crate was on a stack, it would check every update to see if the crate below was moving, within a certain distance boundary and then recenter onto that position. It was ugly and didn't work that well.
Parenting became the saving grace, not to mention the current form we use now to move crates and players being forced by crates. This system has worked flawlessly so far, and as intended. The idea actually came about when reading about a way to attach props to models in Unity that could be remove such as hats and things.
How it works is that if a crate is on a stack, it moves right along with whatever it is attached to. The only thing it has to check for is if it going to be blocked, and act accordingly. This same system is used for players being moved by a forced object too.
To an extend you can actually think of crates as a sort of third character, one that your not able to directly move.
I'll be doing a series of these sort of posts. Going from where we started with a part of the game to where we currently have it. So keep an eye on the blog!
No comments:
Post a Comment