x


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!

more ▼

asked Jun 04 '10 at 11:19 AM

Roshan gravatar image

Roshan
1 1 1 1

what's happening when you try your script currently? any errors? It looks okay at first glance.

Jun 04 '10 at 11:30 AM duck ♦♦

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...

Jun 04 '10 at 01:17 PM Roshan

Duck where do i put the script? i havent got the script anywhere

Jun 04 '10 at 01:34 PM Roshan
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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!

more ▼

answered Jun 05 '10 at 06:23 AM

_Petroz gravatar image

_Petroz
3.6k 27 35 57

very nice tutorial...just what i was searching for....thanx Petroz

Apr 22 '11 at 04:33 AM MohdGasim
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5272
x3892
x351
x200
x100

asked: Jun 04 '10 at 11:19 AM

Seen: 2785 times

Last Updated: Jun 04 '10 at 11:19 AM