- Home /
Help with door animation
Ok this is p robably around somewhere but i need it quickly
I have a sctructure with an "Entrance door" [preanimated in cinema 4d]
In cinema 4d this door is animated as follows:
door opens: frames 0 - 25
door closes: 30 - 55
closed position: 55 - 60 [the door does animated correctly in cinema 4d etc]
In Unity
Entrance door > Inspector panel > animation (is ticked) >Animation (none)
I also have the following script titled 'animationTrigger'
//the trigger function OnTriggerEnter (col : Collider) { var door : GameObject = GameObject.Find("entrance door"); door.animation.Play("open"); }
function OnTriggerExit (col : Collider) { var door : GameObject = GameObject.Find("entrance door"); door.animation.Play("close"); }
however
I also have a cube which is a trigger (it is ticked).
What else do i need to do to make the door open and close whenn my fps walks up to it??
Please explain simply im not an expert. Sorry and thanks!
what's happening when you try your script currently? any errors? It looks okay at first glance.
Nothing happens. No errors. I just go right through the door as if its not there. the door does not move. The trigger is right infront of the door in the right place and big enough...
Duck where do i put the script? i havent got the script anywhere
Answer by _Petroz · Jun 05, 2010 at 06:23 AM
Will Goldstone, author of Unity Game Development Essentials, has a video series which covers animating a door exported from Cinema4D:
Lesson Two [Cinema 4D Animation & Interaction]
Part 5 shows how to setup objects and code in unity.
Hope this helps!
very nice tutorial...just what i was searching for....thanx Petroz
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Button at one end of the room opens door on other 0 Answers
A node in a childnode? 1 Answer
About door opening with mousemovement! 5 Answers
my script not working..!!! 1 Answer