Answered

Manipulating external objects

thecodehermit 3 weeks ago updated by Peter - Soxware Developer 3 weeks ago 1

Hi I am wondering how to go about manipulating external objects from my character. Lets say I have a rigged character and I want him to grab and take an orange and then throw it towards something else. What will be the best way to do that ? For the moment I have been using sort of a cheat, by integrating the objects as part of the character model, though I cant use that for every random object in the future. 

UMotion Version:
1.25p01
Unity Version:
2021.1.4f1

Answer

Answer
Answered

Hi,

thank you very much for your support request.

So first of all, in Unity animation files can only address objects that are a child of the Animation/Animator component. In other words, you can't access objects that are lying around in your scene directly from within your character's animation.

So in every case, this involves  scripting and can't be done purely with pre-made animations. There are simple ways and more complex ways to implement a pick-up system depending on what level of quality you want to achieve. An easy way would be to create a pick-up animation that is rather generic in which the character just picks into the air. Using animation events you can trigger a "pick-up" script in the right moment . This script then checks if there is an object that is "pick-up able" nearby and if so parents it to the players hand.

More sophisticated approaches would use runtime-IK to adjust the pre-made animation to always reach exactly to the object no-matter the current player offset. You could also add different grab-poses per object... As you can see, this can get rather complicated very quickly.


Please let me know in case you have any follow-up questions.


Best regards,

Peter

GOOD, I'M SATISFIED

Ah I see, I hopped that there was a quick and easy way already integrated into umotion. I guess I can go with the generic animation approach and trigger a object animation when a character reaches for something. Though I guess it will be a bit hard to animate when you animate the object, but cant see the character position in time. Anyway I will figure something out, thanks for the help.

Satisfaction mark by thecodehermit 3 weeks ago
Answer
Answered

Hi,

thank you very much for your support request.

So first of all, in Unity animation files can only address objects that are a child of the Animation/Animator component. In other words, you can't access objects that are lying around in your scene directly from within your character's animation.

So in every case, this involves  scripting and can't be done purely with pre-made animations. There are simple ways and more complex ways to implement a pick-up system depending on what level of quality you want to achieve. An easy way would be to create a pick-up animation that is rather generic in which the character just picks into the air. Using animation events you can trigger a "pick-up" script in the right moment . This script then checks if there is an object that is "pick-up able" nearby and if so parents it to the players hand.

More sophisticated approaches would use runtime-IK to adjust the pre-made animation to always reach exactly to the object no-matter the current player offset. You could also add different grab-poses per object... As you can see, this can get rather complicated very quickly.


Please let me know in case you have any follow-up questions.


Best regards,

Peter