Friday, September 8, 2017

TOE week 52: Only 990 miles to go!



It has finally been a year of work. I’m not sure what mile we are on. As stated on day one this is a 1000 mile journey. I think I have gone about ten miles. Meaning that this will be done in about a hundred years…. Great! I’m almost there!

 Above is what the game used to look like vs what it looks like now. So much progress and still a ways to go.

This week I worked on better population for my level.  You know setting up shop. More enemies, putting in sub weapons, and ammo. The basic outline needed to have some things to do in it. Things to fight and power ups to grab. The level is slowly becoming more flushed out. 

Last week I found out about a couple of things that I needed to fix. This week I found one more. Two  weeks ago I set all of the level collision boxes to be Convex Colliders. It is a check box in the Mesh Collision in Unity and I’m not really sure what it means. I want to say that this makes the inside of the Collider count as collision as that seems to be the effect.

I noticed that my teleport test only triggered when the teleport tester collided with the edge of the collision in the past. BUT you could move past the collision edge and it would then be legal to teleport and you could fall out of the world. This is bad. Changing all of the collision to Convex fixed this. So again I am assuming that is check box means check on the inside of the Collider. The actual definition of the word means curved outward like and oval or all interior angles are less than 180 (and that also means curved outward).  And looking at the Unity Docs says nothing about testing for collision inside the box just that it can collide with other convex colliders something that it was doing before I checked the box just not as well as I would like. 

So I checked the box and went on my merry way making my new level. And unknown to me at the time this broke my grenade sub weapon. This is just something that often happens while in development. You find a problem, fix that problem, and create a different problem. Two weeks later when I trying to use my sub weapon it no longer explodes on impact with the collision. Why? Because the sub weapon didn’t play well with a convex collider. 


My grenade sub weapon changes its angle based off of the angle of the collision that it hits. To do this it needed to know two things. 1 the angle of the object that it collided with and 2 the direction of the slope. Angle of the object is basically the normal of the object the grenade hit minus vector3.up. The slope was calculated using a function I found online to get the 3D vector of an object based on all faces. This function doesn’t work with convex colliders. Well crap. Funny story though: hit.normal will basically do the same thing it is built into Unity and works with convex colliders. HILLARIOUS I know. I also had hit.normal in the code for this and it wasn’t hooked up to ANYTHING.

Say while we are on the subject of things I don’t understand. What is the front of an object? Or how do I tell Unity that THIS is the front of an object? I installed some tracking logic onto my spot light enemy. 



I get why Unity thinks that the front is over there. It is because computers are only as smart as you tell them to be. I never told Unity that THIS is the front. But I’m not sure even how to tell the lookRotation ‘hey this is your ‘front’’. Probably just means I will have to find out next week. My spotlights now rotate toward the player when the player is spotted but I now know that ‘toward’ is a very relative term.

So I guess this is the end of Year one for project TOE.

No comments:

Post a Comment