Is it better to create align position every time i wan't to move NPC or not?

Hi, i making RTS game and i decided to use align position&orientation to move NPC, but i thinking which way is better:

  1. Have attachement, Constraints inside NPC model from beginning

  2. Have only attachement in NPC and every time i click to move unit, it will create constraints and then destroy them when NPC will reach target

  3. Create everything when click and then destroy it

Which way is better and more efficient?

I would probably go for the first option. Reusing is normally more efficient. Besides, AlignPosition and AlignOrientation can be enabled and disabled.

Edit.

Destroying after each use reduces the number of instances in workspace, but continuously creating instances for regular use in lots of NPCs is most likely inferior.

1 Like

I assume there’s a cutoff based on how often you use it, but just leave them in. You can just disable them if they are not in use.

1 Like

ok, thanks, now i decided to enable them if needed and then disable them, i’ll store them inside RTS unit model, because there will be about 50 units max per player, soo i even don’t have to handle them on client

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.