|
I want to change a Boolean on multiple or a single object when its within a certain distance. Im new to c# and I'd much rather program this game in c#. So i was thinking of having some variables like these. Could I set up a function to where it finds game objects with the activate tag (activated objects variable) within a certain distance (radius variable) and than have a Boolean in those objects that were found and change it from false to true or the other way around. Much help is appreciated. Thanks
(comments are locked)
|
|
I often use trigger areas that activates objects, this way you won't have to worry about clutching up the overhead to much. While the objects are active I check for a distance > player trigger area (using sqrMagnitude), if it is then disable their demanding components. This require rigidbodies though, if your game doesn't use physics then run a invoked coroutine checking for sqrMagnitude on the objects. Thanks! Not even my question but the idea of trigger areas will help me soon. =)
Sep 20 '11 at 02:14 AM
Essential
(comments are locked)
|
|
See my answer to your duplicate question- http://answers.unity3d.com/questions/168486/changing-booleans-throught-certain-distance.html. You should avoid posting duplicates- remember that when you have below 15 reputation, it takes a few minutes for your questions to be cleared by the moderators! You just have to be patient. In the meantime, please close and/or delete any duplicate questions.
(comments are locked)
|
