Hi. I want to move some objects witch have fixed from and to positions and rotations, and since I want to make an action list asset file I would like to use component variables, so I could attach them to the object to move. But it seems to me like the only option is to use global variables. Or maybe create a variable holder object to hold all of the variables, so they only appear in the scene and not clutter the global variables. Have anyone any ideas how to make this pretty?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I'm sorry, but I'm not clear on where or how you're using Variables. Is this for an Object: Transform Action?
Can you share screenshots to explain the situation - both what you're trying to achieve, and what you've set up so far? Likely something can be done, but I'll need to be more sure of the situation first.
Here's an image:
Imgur
The idea is to have an object on for example table and when player clicks to exam it, it comes closer and rotates - and after examination it returns. I would like these positions and rotations to be stored preferably in the movable object itself and to have the action list as an asset file. Now the variables clutter global variables.
If such objects are PickUps, you can automate the returning to it's original orientation with this script on the AC wiki:
https://adventure-creator.fandom.com/wiki/Return_PickUps_to_original_position
Otherwise, you can rely on a Marker to act as the placeholder position/rotation values. The Object: Transform Action has a Copy Marker method that will influcence an object's position as well as rotation.
If you create a Marker in the scene named e.g "DummyMarker", make it a prefab and attach a Constant ID component to the prefab. Check Retain in prefab?, so that it's ID in the scene has the same value.
Then, before you start moving the object you wish to move, precede things with an Object: Teleport Action to place the Marker in the object's original position. You can then use an Object: Transform Action to return the object to the Marker once finished.
Hmm. Object: Transform doesn't take marker as an argument.
Oh, now I got it.