Download

Get Distance Problem

Hi there,

I’m trying to build some code that basically gives the distance between a trigger and the players last location on key press.

I’m using the following code to set each trigger location in a variable:

Perform the calculation on key press then output:

Now there’s a bit of an issue there are a shed load of triggers in my map but only one active one at a time that updates the trigger position value each time, each trigger activating the subsequent one.

So trigger A once selected/triggered will move trigger A below the player surface (making it inactive) and brings trigger B to the player surface so it can now be triggered by the player.

Each time the next trigger is brought in it updates the trigger location variable.

What am I doing wrong here?

Can Anyone help?

what is happening with your current setup that is wrong?

It doesn’t seem to update correctly

you may be aware but I don’t think the move component to node is going to move the actor position. it’s just moving the collision part of the actor.

that’s the only way you can get the trigger to move, seems to work though?

its the updating that’s an issue

just tested. i was mistaken, seems that if the component being moved is the root then the whole actor is moved.

Sorry I’m not sure what’s wrong then.
maybe put a few print strings in there at various point to make sure the events are being called at the right time. see if you can find the point where the code doesn’t work as expected.