• Unity
  • Character interractions

Related Discussions
...

Good Day! I have some questions (maybe they a bit stupid)
I have a character with eyes which pupils motion recorded in animation (for example in idle) And i need at specific moment character to start proceduraly look on dragged objects. Which is the best way to realise this function? I saw 2 solutions right now. (Im using MecanimSkeleton)

1) Create separate animations for pupils in 4 directions (like in owl example) and create blend tree on separate layer in animator.
2)Duplicate idle animation but remove keys on pupils and add event at start of animation , after that - set override mode on pupils bones at runtime (idk is it possible) and use with something like constraint.
or maybe there more right and better solutions for that.

And the second one
I need character interact with dragged on him objects. For example - we drag apple on character and character catches it and starts to eat.
Could I add point attachment in right place on character, and in unity - dragged object will magnets to this place, and character will start animation where he catches this object (object also will be added to character and one will be as separate object in unity - its just will turn off when animation starts)

As you can see - Im not good in unity and programming :lol:

Regarding the first question:
Did you look at the example scene Spine Examples/Other Examples/SkeletonUtility Eyes that comes with the spine-unity runtime? This could be the easiest solution.

I need character interact with dragged on him objects. For example - we drag apple on character and character catches it and starts to eat.

This could be solved in multiple ways, with different complexity. You could create an IK setup in Spine so that the hand IK target can be moved to the apple. You can check out the Spineboy example project in Spine, and the Spine Examples/Getting Started/4 Object Oriented Sample example scene on how to programmatically enable (increase the weight) and move the crosshair IK target bone, which lets Spineboy aim at the target point. Alternatively, you could also gradually move the apple towards the hand bone (the inverse solution), which adjusts the apple instead of the hand. You would then use a BoneFollower component which lets a HandTarget GameObject follow the location of the hand bone of your skeleton. Then you can add a newly created Attractor script to this HandTarget GameObject which then attracts the apple object towards it (you can search the official Unity forums on how to achieve this).

Harald wrote

Regarding the first question:
Did you look at the example scene Spine Examples/Other Examples/SkeletonUtility Eyes that comes with the spine-unity runtime? This could be the easiest solution.

Thanks for answer! Just saw this example and it looks like perfect solution, tried to turn on follow mode with assigned script and it works

About second question - I think BoneFollower or PointFollower looks better for me. It will translate "apple" to right place after it touch character collider and after that another apple will turns on in characters animation.

Thank you)

Thanks for getting back to us, glad it helped! 🙂