|
Hi. I would like a door that opens as soon as the player get's close enough (no need to press any button). The player is a Standard Asset prefab for an FPS. To door would open vertically and go up as soon as the player get's close to it. Thanks
(comments are locked)
|
|
Set up an empty game object in front of the door, make the collider a trigger, and attach an OnTriggerEnter code on it. Compare the tag of the collider and if it's "Player" tag, have the animation play and the door open. How do I make the animation?
Nov 03 '10 at 11:21 AM
Antonios
Antonios, you could for example make a script that would slowly raise the door a certain amount. Then perhaps do the opposite on OnTriggerExit.
Nov 03 '10 at 02:58 PM
Matti Jalopeura
My animation makes the door Open and Close directly, how do I split the animations? I made them with unity so they do not appear on the FBXimporter...
Nov 04 '10 at 01:52 PM
Antonios
(comments are locked)
|
|
HI....although a newbie to both Unity and scripting...i found this using Raycast, just make sure your door has a collider and Is Trigger is off.... var RayCastlenght = 2; //allows you to change the distance required to trigger the door function update() { var hit : RaycastHit;
what you need to do is compose an animation for the door to open and then change Bookcase_anim with your new animation..... best of luck Thanks, this helped^^
Nov 16 '10 at 01:01 PM
Antonios
(comments are locked)
|
