# Week 4
This week was a very independent week for our group. The designers designed, the coders coded, and the dreamers dreamed. We each explored various concepts on our own and have yet to formally meet up.
# A (Simple?) Todo List
Last week, I worked with Justin to get the basic flying mechanics of the moth working. I wanted to test out another core mechanic which involved avoiding various objects in the player’s path. This meant that I needed to implement a few basic things. First, I needed to add some objects that the moth could avoid, for testing purposes I opted for some basic rectangles. Next, each object needed to contain a collider so that the physics engine knew to not let the player pass through them once I added a rigidbody and character controller to the moth. Finally, I needed to write detection code that would listen for the occurrence of a collision between the moth and one the grey rectangles, from there I could experiment with restarting the game. This proved to be a bit of a headache and has been something I still have not achieved.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeathDemo : MonoBehaviour {
void OnCollisionEnter(Collision collision){
Debug.Log("Collision detected"); // No luck :(
}
}
# Collision Detection
As one of the team’s developers, I worked to try and get the collision detection code working. Following multiple tutorials, it seemed simple enough. As long as the player object had a rigidbody and the object it was colliding with had a rigidbody and collider, OnCollisionEnter()
should be triggered if a script attached to the moth contains it. Some guides even further stipulated that at least one of the rigidbodies that were colliding had to have “Is Kinematic?” unchecked and despite confirming this was the case, my function was never triggered. I will try to work with Justin this coming week to debug the issue and get everything working but for now I have a seemingly unreachable function and not much to show for it.