#Entities following another entities localtoworld. Is this a performant way of doing things?

1 messages · Page 1 of 1 (latest)

inner karma
#

Hi all. This is my first dive into doing something serious with ECS so please bear with me. I understand the concept where its an array of struct so that ISystem can iterate throught the array to avoid cache misses. Allow me to explain the scenario. I am using a pathfinding system where it has DestinationPoint IComponentData. The agents will move based on the destination (float 3). The way I am setting this up is that there is another entity (the target )that moves around and the DestinationPoint is updated with the localtoworld of the target. The target enity has an DestinationTag IComponentData. I wrote an ISystem to do that. Seem to work. I can move the target via scene view and the agent follows it around. Attached is the code;

The question I have is this the 'right' way of doing it? I have a feeling it is not. Also based on what i understand, the idea behind ECS is to operate on a 'chunk' here I have a foreach and in that foreach im accessing a destination variable. Won't this cause cache misses?

crystal geyser
#

Is there only ever one Destination Point?