Forum rules - please read before posting.

Hold object

I have a problem, which is that when I Hold an object and put it in the player's hand, I don't know how to move it to the place I want.
Example: I carried food and I want to give it to person. When I go to the person, the food is not given to him
Note that I tried the Scene item method, but it seems that I did not understand it correctly
Can someone give me a simple way to do this?
or explain to me the Scene item with steps because I did not understand it from the manual

Comments

  • All object-holding is done through the Character: Hold object Action. The process is the same for NPCs and Players - so long as they have "Hand bone" Transforms assigned, they can holdobjects.

    Is the issue to do with referencing the object you want to hold, due to e.g. spawning it at runtime? What object exactly is to be held?

    If you're dealing with an Inventory item, and the object is that item's Linked prefab, then - if only one instance of that object exists - you should be able reference the prefab in the Action.

    If not, best to see what you have so far - as the Scene Item component's usage depends on the situation. Share details of exactly what's being run, what objects are being involved, and your AC/Unity versions, and I'll try to spot what's wrong.

  • this is not my point, I can use Character: Hold object Action without problems
    But after I put the object in the player's hand, I want to know how I can make the player put it somewhere else
    For example, the player has a sword in his hand and wants to place it on a table. How can I implement this?

  • edited December 2023

    That's because you have to first unparent it from the hand and then move the object to the other NPC/Place.

    There's two approaches to that:

    • You can either remove/disable the one from the Players hand, and spawn/enable a new one where you want it.

    • You move the (moveable) Object from the Player to the Point/NPC you want it at. (I think this is what you want)

    First you need to "unhook" the Object, by using Object: Set Parent and set the method to Clear Parent. Now the object has no parent, so it's free to move wherever you like.

    After that you either teleport the object to the Marker where you want it, with Object: Teleport OR you make it a moveable and "animate" it's movement (by adding a moveable component to the object) and you can translate it with the Object: Transform action, and again i'd recommend using Copy Marker in that action, and a transition time, to move it where you want it.

    If you want an enemy to have the Object you use Character: Hold Object, which you are already familiar with.

  • edited December 2023

    I need to be clear on the fundemental issue. It sounds like this is to do with getting a reference to the currently-held object - i.e. knowing which object to assign in an Object: Teleport Action to place the object on the table. Is that right?

    I think the best way to handle this would be for the Character: Hold object Action's Drop Object method to provide a means to update a GameObject parameter with the value of the object being dropped - allowing it to be referenced elsewhere in the ActionList.

    I'll add this functionality as part of v1.79.2 - thanks for raising the need for such a feature.

  • Yes, that's what I meant. thank you both Chris and snan

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.