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.
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"
Next I added a Transform to Variable node
Then I added a Change Game Variables node
And finally a Change Position node
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.
Now when approaching the gate
And then when it actually triggers, the gate does this:
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.
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!
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.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Created a Game Event called "gateUp" and first set up the "Event Actors"
Next I added a Transform to Variable node
Then I added a Change Game Variables node
And finally a Change Position node
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.
Now when approaching the gate
And then when it actually triggers, the gate does this:
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?)
See the how-to on game variables for details :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!