Sunday, August 26, 2018

TOE week 62: Starting a Vertical Slice


Unity has two different functions basically built into it called OnTriggerEnter and OnTriggerExit. OnTriggerEnter sees if the edge of a collider is touching the edge of another collider and you can send a message. OnTiggerExit sends a message when two colliders stop touching. 

Last week I step up my Red Switches that activate when the Player Portal touches them. This works pretty well. EXCEPT when the Portal Collision contains the Red Switch entirely. The two objects are not touching because none of their edges meet. 

When I watched a Youtube video about how to be an indie dev it said that you don’t have to make all of your game objects to be completely 100% functional. The advice I received in my head basically said ‘you should probably move on to another thing’. However the fact that it wasn’t working was taunting me. I needed to solve this problem…. I am super bad about letting things go. 

So I decided to refine my red switch and make it function correctly because it should be activated when contained. However there is no function built in that does this I had to write my own. But that made me wonder why there isn’t a OnTiggerContained?

It really wasn’t that hard to build myself. It is basically just: PortalMeshCollider.bounds.Contains(redSwitch.transform.position). There is slightly more to it than that but after all of that was in my Red Switch was about a 100% better. Before I built my own version of this I tried making the Portal collision convex because I was under the impression that meant ‘not hollow’ BUT that didn’t work. 

After that I set up a Basic Switch. Very simply a switch that when struck by the player weapon it would move or rotate something. 

Most of this week was spent on making a vertical slice of the game. It isn’t anywhere close to completion. I was working on a vertical slice a while ago but I was building the level in blender and importing it into Unity but that was slow. Now I have switched over to probuilder. Much faster AND the editing is done in Unity so I do have to switch back and forth all of the time. I will probably have to use blender for the UVs when I get to the art portion of this but I’m not there yet still have to block this out. 

Also I made a video of what I made this week. 


No comments:

Post a Comment