- 已编辑
How to control direction with using transform constraints in
Hi.
I made a character it can change face and body direction with transform constraints, and I searching how to control it in Unity now.
I want to make it that if the user click on screen and the character's face and body direction face to the point.
I remember I saw preview of Spineboy's aim changing with mouseclick...
It was fit my ideal, but I couldn't find out it again...
If there are some references like that, I'd like you to share it for me.
Thank you in advance.
To look at a point you can use a combination of IK and transform constraints. Open the spineboy project and move around the crosshair
bone. Note the aim-constraint-target
bone is always pointing at that crosshair
bone, using IK. Next there are aim-*-transform
constraints that adjust rotation of other bones to match aim-constraint-target
. Those constraints aren't active in the setup pose, but they are in the aim
animation. Go to animate mode, set the aim
animation as active, then translate the crosshair
bone. They use mixes < 100 on the transform constraints to get more or less rotation from the aim-constraint-target
bone. At runtime you can move the crosshair
bone to where the user clicked.
You can also read in detail how the spineboy project was built here:
Spineboy example
Thank you for your answer, Nate!
To tell the truth... I have solved the problem just few minuites ago.
I have poor Unity-runtime knowledge, so I couldn't understand how can I control the point in Unity, and I posted this question... but I found another sample.
Spine - Skeleton Utility - Eye Constraint - YouTube
It showed to me what I want to know.
But also, your answer is helpful to me.
Thank you so much!!