message to trigger ReplaceMesh? not working?


In short: How can I make say object X send a MESSAGE actuator and then object Y get that same MESSAGE and get replaced by object Z through a EDIT OBJECT-> ReplaceMesh actuator?

The whole, detailed explanation:
I am currently making a game where the main character is actually a simple plane with an alpha-enabled png texture applied to it. It’s currently applied uv texture is an ANIMATED texture showing the character’s walking cycle. Problem is, he is ALWAYS animated, even when not actually moving. I created an empty at the plane’s base, and made it parent to the plane. I am using this empty’s logicbricks to recognize keyboard input and move the character around. I am also using logicbricks on the plane itself, to make it flip sides according to the direction of the movement (left or right). What I need to do now it replace the walking plane with another plane wich has exactly the same size, but a different uv texture applied to it (an animated texture showing the character impatiently in place) every time the player stops pressing the directional arrow keys and the character stops moving. I tried using a MESSAGE actuator on the empty base with a “stopit” subject, then using a MESSAGE sensor on the “walking” plane with the same “stopit” subject, directing to a “EDIT OBJECT -> ReplaceMesh” actuator pointing to the “stopped” plane (wich is out of the camera view for now btw). But nothing happens.

Thanks for helping!!!

:smiley: :stuck_out_tongue: :slight_smile: :smiley: [!]

:o Heh, kinda long so I skimmed through it. I wouldn’t use a message actuator since that’ll run into some problems sometimes. If you’re doing a sprite tile animation on a plane, then I’ve got a tutorial for you. Don’t worry I’m not using the UV animation setup for the Blender GE that just keeps playing the anim over and over again. I’ve been meaning to write it for awhile, and since I’m done now go take a look. It’s a relatively new site, kind of so that’ll be the only 2 tutorials you see there for now.

%| Umm, it has some python so I hope you’re ok with using python in blender.

Well I hope it helps. Post any feedback on it here and I’ll see what I can change or do to make it easier to understand.

Jason Lin

hi… took me several days to reply but first of all THANK YOU VERY MUCH, this is a very enlightening set of tutorials for me! I read both of them through and managed to make it work like a charm. But I have an optimization question for you: The tutorial is meant to be used with several separate planes for each animation cycle. E.g. for the walking cycle you constantly replaced the displayed mesh with plane1, plane2, plane3 etc. Before reading your tutorials, while waiting for a reply to this topic, I came up with a different solution to the problem: I created a single plane for the walking cycle, and applied an animated texture to it. Then I created a separate plane for the “waiting” cycle and applied a simple texture to it. Isn’t it less expensive for the CPU to just toggle between these two planes instead of constantly changing several single-framed planes? Then I guess I could adapt your python example to this toggling option. Please reply THANKS!!!

:stuck_out_tongue: :smiley: :slight_smile: :o :o

:wink: I’m glad you liked the tutorials. Hehe, I’m happy it’s understandable.

So what you’re basically saying is have 1 single plane that’s animated and another one that has the idle animation on it. Yeah, I think that would work. :expressionless: Even simpler I think.

:wink: I did it that way in the tutorial because I wanted to use existing sprite sheets without modifying them at all. (They’re not tiled to perfection) Hmm, I’ll try it the way you suggested and put up another tutorial with that method.

Gotta modify the sprite sheets first.

Jason Lin