Week Seven

This week using Unity and Cinema 4D, we had to create a simple door trigger.
Firsly I had to create a simple door in Cinema 4D and animate it to open 90 degrees, then shut again

Screen Shot 2015-03-25 at 14.59.51

I then saved this as a .fbx file and imported it into Unity.

Once imported I needed to change the animation type to legacy and then add the three states of animation, which were idle, open and close. To do this you need to add a clip, specify what state it is then allocate what frames in the animation link accordingly. For example. idle would be frames 1-10 because in the animation, between those fames the animation is idle to the door is just closed. Then open would be 10-30 as those frames have door opening. etc.

Once the states were created I need to add the box collider which would act as the trigger radius, so once walked into would trigger the door to open. I scaled the collider to be bigger  than the door so that it would activate upon approach.

Screen Shot 2015-03-25 at 14.57.32

I then had to add the script that would make the door animation

function OnTriggerEnter (col : Collider) {
animation.Play(“dooropen”);
}

function OnTriggerExit (col : Collider) {
animation.Play(“doorclose”);
}

Recent Posts