Sometimes however you may want precise control over when a sensor is pulsed, for example a bullet may want to pulse its sensor just before it determines whether it has hit anything. Each of the sensors can be configured to automatically pulse themselves at fixed intervals or every frame. This will cause the sensor to perform its 'sensing' routine that adds and removes GameObjects from its list of detected objects. Sensors update their list of detected GameObjects by being pulsed, that is by having their Pulse() method called. If (sensor.GetNearestByName("Player") != null) GetNearestByName returns the nearest detected GameObject with the specified name, or null if there is none detected. RaySensor, RangeSensor and TriggerSensor all extend Sensor This sensor could be placed at the end of a maze to check if the player has reached the last room and escaped. Here's how you might write a MonoBehaviour that uses a sensor. This simple range sensor setup allows the worker to see the piles of bricks around him.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |