PDA

View Full Version : Turning a croup of actors on and off in RT


spatte
13th May 2004, 04:32 PM
Hi!

Maybe somebody can help me out with this one. I am making a forrest as a part of a research program at the Uni and I would like to have the names of the trees floating above the tree tops. Like in the screenshot

No to my problem. I would like to be able to turn them on and off when I am running the map, preferably with a single keystroke if possible. I am not much of a coder, so please be gentle in your explanations ;) Good tutorials and such are much appreciated

//Spatte

dug
16th Jun 2004, 11:13 AM
Have you had success with this yet? If not, maybe I can suggest something, and more experienced people can correct my errors.

You could make the names be ScaledSprite objects, which you could place in the map above the trees. At runtime you could toggle the "bHidden" value of all of these sprites to make them visible/invisible.

I suppose the way to do this is to use the "Interaction" class to pick up the keystroke. Then iterate through all the ScaledSprites and change their bHidden value. There are two difficulties, though. Using the AllActors iterator would be a convenient way to find all the ScaledSprites, but this isn't available to an Interaction object because it isn't an actor. Also, if you're using ScaledSprites for anything else, you may not want to toggle their visibility.

A way around the second problem is to extend ScaledSprite with ToggleSprite, which could have a ToggleVisibility() function. Then you could look for all ToggleSprites and call that function for each, which would leave other ScaledSprites untouched.

There may be some easy solution to the first problem, but I don't know it. What I do is extend the pawn class (like ExampleBoy), and give it a function (say ToggleLabels) that will iterate through AllActors, find the ones I want, and call their function. Then in the Interaction (in the PostRender function) I look for PlayerOwner.Pawn and call ToggleLabels in that actor.

I realize this leaves many details unspecified. If you're still interested in the problem, I could be more specific. Maybe someone can suggest a better approach altogether, or tell us why this one wouldn't work.

Jojodi
25th Jun 2004, 04:42 PM
hmm interesting idea.. I would say that each tree in the map could have a name and a US that could find the names of the X closest trees then draw those names at X height in their direction. hmmm... lemme study on it