How do you make something have two different appearances?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By goshot

If you have something in a scene that has two completely different appearances, but the same underlying data (ex: hitpoints), what do you do?

  1. Have one node that can switch its draw commands, textures, meshes, materials. etc. to look different on command.
  2. Have two nodes, one for each appearance, and make one visible and hide the other as necessary.
  3. Have two nodes, one for each appearance, and load one node tree and remove/free the other as necessary.
  4. Something else…
:bust_in_silhouette: Reply From: johnygames

If I were you, I would choose option #2 for it being the easiest. Option #1 is tedious and you should use it only if your objects are extremely modular in nature. For example, imagine making a Dress-Up game or even a simple character customization system. You wouldn’t want to create thousands of nodes for every possible combination. Instead, you would want to create a base node and have the code alter the different aspects of your objects via draw calls, mesh swapping, texture modifications etc.

For a small project, you could just hide and show the premade nodes. If your character has two skins, make two nodes for them. You can also disguise the fact that you alternate between two or more versions by adding animations and particle effects.

Thanks. My concern with #2 is visibility flag only controls visibility. When nodes remain in tree, they can still interact with other logic, like overlapping checks.

goshot | 2019-08-23 20:56