|
I want my player to be able to pick up an object and use it to open a door (make a plane or box dissappear or be destroyed) when the player gets near it.
(comments are locked)
|
|
Thanks for your help, I'm just getting started with level design, and all suggestions are appreciated.
(comments are locked)
|
You put that script on a little trigger volume (collider with 'isTrigger' set to true), and then link it to a door object in the inspector. Then, if something enters the trigger, it'll delete the door, and then itself. OR to do Zelda style one-use-antimatter-keys- On your player (somewhere in your player script) Then, on your pickup a slight variant on the first one- That gives you a key, and destroys the pickup. Then on your door, something else similar (have a trigger volume along with an actual door- so that if the player enters the trigger with a key, the door opens) That's a little more sophisticated! If you wanted to check for specific keys, you could go even further and do something like this- Then in your triggers for the pickups and the doors, use- (Thanks, @wccrawford, for the suggestion!) Whoops, that's not very good. Let's do it in a more complex way!
Oct 11 '11 at 12:34 PM
syclamoth
And of course, you could modify that last version to actually keep track of specific keys, instead of just counting how many you have.
Oct 11 '11 at 12:49 PM
wccrawford
Oh yeah! I should post one of them as well.
Oct 11 '11 at 12:50 PM
syclamoth
There you go! I need to go home now.
Oct 11 '11 at 12:58 PM
syclamoth
(comments are locked)
|
|
Then you'll need a few scripts. When the player collides with the 'object', the script needs to set a variable (probably on the player) that says the player has the object. When the player activates the door, the door's script needs to determine if the player has the object.
(comments are locked)
|

A question usually ends with a ? I don't see one.
"pick up an object", could this be like a KEY-object perhaps?