Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

How can I make a character grab an object at different object points?

Discussion in 'Animation Previews' started by Ratslayer, Mar 31, 2020.

  1. Ratslayer


    Feb 6, 2014
    I want to be able to grab an object, a sword in my case, at any place at runtime, like by the handle, the guard or the blade. However, I don't want it to be predetermined, but decided at runtime at the time of parent switch. I tried to use multi-parent constraint, like in the sample, but it only allows to snap the sword transform to another transform, while I want to preserve the offset between the sword and the hand at the time of grabbing.

    I tried to use Maintain Offset option in the settings, but all it does is preserve the offset between the sword and the hand at the startup time, so basically the T-Pose. When I switch the parent weights, the offset is not recomputed. In fact, none of the settings are updated at runtime - I am not sure if that's intended behaviour.

    Is there any way to achieve what I want with the existing constraints?
  2. hawaiian_lasagne


    May 15, 2013
    The MaintainOffset is only calculated at startup afaik.

    You could try offseting the ref_hand node by the sword offset measured at runtime maybe? Or create a child node of ref_hand, and use this as the target. You can then move that child node relative to the hand and set it's offset by whatever you need