Forum rules - please read before posting.

Object: Teleport to floating marker


We're working a first person 3D game where the player can pick up and drop items.
To achieve the drop mechanism, we are running an actionlist asset that executes the following actions:

Inventory: remove
Object: add
Object: teleport (to marker)
Hotspot: enable
Object: visible

The marker is actually the player prefab with a marker script.

This seems to almost work, except that it appears that the marker used is the previous location of the player, not the current one. The video below can show it much better, please pay attention to the player's transform during the first drop interaction and then the pillow's transform during the second drop interaction, they are identical.

Does anyone know at which point the marker's transform is stored? It seems to save it after the action is performed instead of before.

Is there perhaps a feature I have missed which could resolve the issue?

Thanks for looking into it!


  • It's difficult to see from the video exactly why that's happening, but parameter values are assigned at the time the ActionList is run from the beginning.  However, only the reference to the Marker is stored - so the actual Marker's position will be referenced at the correct time, i.e. when the Object: Teleport Action is run.

    It would be worth discounting any colliders on the object that may be moving it away, but one thing you should look into is setting the Relative to field on the Action to Player, and then teleporting it to a scene-located Marker placed at the origin of the scene.  This will cause the player's position to be added onto that of the Marker's, but due to the Marker being at the origin it will then use the Player's position completely - no need for a Marker on the player prefab itself.
  • Hi Chris,

    Thanks for getting back to me so quickly.

    There are only 2 parameters in the actionlistDrop, ObjectInQuestion (the game object itself, also used for hotspot) and InventoryItem (used to add and remove from inventory).

    I attempted the solution of adding a marker at the origin (called DropPlace) and setting the Relative to "Player" during the teleport action. I removed the marker script from the prefab player and changed the teleport to the DropPlace marker.

    The results were identical. This means that the relative to "player" off an origin marker and a marker as a component of the player prefab work in the same way to locate the player. The odd behaviour is that it is using the previous location instead of the current one. Here's a quick video.

    I appreciate you looking into the matter a lot. Thanks again!
  • You're welcome.

    It's a strange issue.  I noticed mention of an "InitPlayer" error in your Console - just so I can discount anything non-AC, are you using any custom scripts that might be affecting the player?

    What is the position of the player when you first pick it up inside the temple?  Is there a similarity between that and where the object ends up outside?

    The object does look so close to the player's old location that it probably isn't a coincidence.  How is actionlistDrop being run, exactly?  I would like to see a screenshot of the contents of dropPillow (both Actions and properties).

    One more thing to test would be to create a "dummy" Cutscene that runs actionlistDrop (with an ActionList: Run Action) with the same parameters, which you could then run manually at any time.  If the position is then correct, it'll likely be an issue with the transferral of parameters between the two ActionLists.
  • The warning comes from a script used to crouch. It just moves the camera up and down. It doesn't affect the player object. And, the error is harmless (it's thrown once for an instant during loading, but there are null checks in place, so the game doesn't freeze and the scripts resumes normally after that). Still, I do have to clean it up to make sure it doesn't show up anymore (been busy on other stuff, though...).

    About the actionlist, I haven't looked at them much, so I'll let Olivier tell you about that.
  • Hi Chris,

    Here are the actions and properties of the dropPillow action list.

    Here are the contents of the actionlistDrop. Please ignore the first action, it is checking a global variable that we turn off to skip all the actions.



    Now, on to the interesting bit hahaha. I recreated a hotspot called DUMMY, with the only interaction to run the actionlistDrop with the parameters used in dropPillow. It works as expected; the pillow game object is instantiated and teleported to the player location. Now if I drop the pillow using the inventory interaction (the dropPillow actionlist), it does that old drop in the previous location move. Here's a video of the oddity.

    The only difference at this point is calling the actionlistDrop from a hotspot-led interaction and from an inventory-led asset file. Anything there?
  • Hmm, sorry. You'll have to open the images in a new tab to follow the link.
  • I'm afraid the links aren't coming through on my end.  The forum isn't able to host images - try uploading them to and posting the direct URLs here.
  • Hi Chris,

    Just right-click them and select open image in new tab and they will work.

  • edited September 2016
    Yeah, I also noticed, even though they look like placeholders, if you right click them and select open in new tab, they do show up.

    But, just so people can see them without going through that process, here are the actual per image links (taken right from those urls):



  • Thank you @Alverik - my browser was hiding the links.

    I should've already asked, but what version of AC are you using?

    There are two differences between the Interaction that worked vs the one that didn't - that one is an asset file, and that your asset file has subsequent Actions after the ActionList: Run.  We can discount this second point by temporarily setting the first Action's When running field to Stop, and separately by checking Wait until finish? to ensure any Actions that follow in dropPillow do not interfere with actionListDrop.

    As for the first, what happens if the Object: Teleport Action is removed?  Are we certain it's actually having an effect, or is it's position being affected separately.  What I suspect may be happening is that the actual prefab is being modified, rather than the scene instance of it.  Select the prefab while testing and see if it's position is changing.
  • Hi Chris,

    I'm using AC 1.54a.

    When waiting until finished and disabling all actions beyond ActionList: Run on the dropVase, the same behaviour of teleporting the vase to the previous coordinates.

    Looking at the prefab's transform, you are correct that the teleport action is changing the prefab's values instead of the scene item. Removing the teleport action instantiates the game object at the location of the previously run command, which had moved the prefab transform there.

    In investigating moving the prefab, I found that there are two ways to assign the Game Object (objectinquestion) parameter.

    When using the ConstantID, the game object is not instantiated into the scene.

    When using the prefab via drag and drop, the game object is instantiated into the scene and the transform of the prefab is changed to the player/marker's coordinates. Repeating the action leads to instantiating the game object at the prefab's altered coordinates and changing the prefab's transform again.

    This is interesting because I had noticed a difference between dragging in a gameobjects and using strictly ConstantIDs in the pickupOBJECTS action lists. Using the prefabs dropped into the fields would generate an error when the action to remove the game object was called. Using the ConstantID would not generate the error. I was meaning on asking what the difference was when some of the more immediate hurdles were cleared, but it now appears that there is a significant impact.

    So in breaking this down, I tried the next logical test. I added a gameobject parameter in the actionlistDrop to represent the constantID. When adding the gameobject, I passed the drag and dropped prefab into the parameter. When teleporting the gameobject, I passed the ConstantID into the parameter. It works, but why hehe? Here's the video.

    Do you know why dragging in a prefab vs. using a constantID behaves differently?

    Thanks for keeping up with this!
  • edited September 2016
    I messed up those pictures again. Here we go, for the gold!

    Constant ID


    Prefab, dragged and dropped


    Error when pickupVase using Prefab instead of Constant ID

  • edited September 2016
    Thank you - actually I was going to suggest exactly what you've since tried.  The issue is essentially down to your assigning a prefab that is not instanced in the scene at the time that you run the ActionList.

    If the ActionList: Run Action in question is in an asset file, then only the GameObject (i.e. prefab) reference will be passed on.  If it's a local Cutscene but sending to an ActionList asset file, then both the GameObject and ID number is passed on, because ID numbers are the way for assets vs scene objects to communicate.

    I'll accept that it is a little fiddly, but I'm extremely hesitant to make changes to it as it's a core feature of Actions and even the tiniest change could affect (read: break) existing games and projects.

    The "safe" solution, therefore, is to create a second GameObject parameter that is assigned via Constant ID number only.  Since an ID number can only reference scene files, this will guarantee that its use will only affect the scene-based instance of the object, whereas the first GameObject parameter should only be used to spawn the object into the scene with Object: Add or remove.
  • Hi Chris,

    If you don't mind, I'm going to try to run this back to you in my own words to make sure I got it right.

    When the prefabbed game object is already in the scene, calling it using a constantID specifically calls the constantID game object within the scene? While calling it using the prefab will call to the prefab in the resources folder and not the game object in the scene that shares the constantID?

    When the prefabbed game object is not present in the scene, adding it using a constantID will return a lack of the constantID game object in the scene error? While adding it using the prefab will find the prefab in the resources folder and instantiate it in the scene?

    Does this make sense hehe?

    Thanks for being patient.
  • Kind of - I know it's difficult to explain.

    Essentially it boils down to it literally using the same GameObject you pass as the parameter - so if that GameObject happens to be a prefab, it'll manipulate the prefab.  Passing the CID number will instead force any Action that makes use of it to search for a scene object that shares that CID.
  • Thanks Chris,

    I think I got it now!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.