So I'm trying to make an Event for opening/closing doors when a player gets nearby. I was following the gameplay tutorial for closing/opening doors but I'm having an issue with the Change Position node.

I'm setting the Target Position -> To Object and then I set the Local Space to be enabled and then update the offset to be:

X: 0
Y: 4
Z: 0

But when the Event fires it's resetting my door's X and Z values to be zero. The tooltip says it just adds the value, but it seems like it's settings my target's position to my offset instead of adding to it. I tried using a Transform to Variable node to save the event target's object and then was planning on simply adding a Vector3 value to that saved variable, but I can't seem to find a way to manipulate a variable after I've saved it with a node.

Any ideas?

Thanks!
Post edited by ArneSaknussemm89 on
  • Hm, are you using the correct target object?

    As for changing the variable - use a Change Game Variables node, adding a Vector3 type variable change with the Add operator to add a value to the stored variable.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Still having some trouble with it. Here's what my set up looks like.

    Created a Game Event called "gateUp" and first set up the "Event Actors"
    image
    image

    Next I added a Transform to Variable node
    image

    Then I added a Change Game Variables node
    image
    image

    And finally a Change Position node
    image
    image


    Then, in my scene I created an empty GameObject called "GateTriggers" attached to my "wall" that was housing my gate, with a Box collider much larger than the gate. Here is the event set up.
    image
    image

    Now when approaching the gate
    image

    And then when it actually triggers, the gate does this:
    image

    Sorry for the image spam, figured it was easier to see something if you could see it all lol.

    Although now it seems like the gate has stopped moving entirely in my last test (So maybe I have done something completely wrong then?)
  • The reason why the variables aren't working is because in the variable sections of all your nodes, instead of putting Game Variable, change all of them to value.
  • Yeah, you currently define a variable key that is stored in a string variable instead of just defining a key directly. When using game variables, in 99.99 % of use cases you'll use the Value value type.

    See the how-to on game variables for details :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I forgot I never posted back on here. Thanks for the help! Switching to value for the variable sections definitely did the trick!
Sign In or Register to comment.