Character head turn towards player in VR

I’m trying to get a character, ( a bird) to turn its head toward the location of the camera in VR. I was able to turn the entire body towards the camera, and have attempted to do the same with just the head. I created a blendspace, blending the turn from right to left, and hooking the variable of it to the rotated information. But it clips, and the animation is not a smooth transition. Any help would be great.

This is the blueprint of the bird

R Interp can’t blend it snapps to target, The lookat and the birds Rotate is off axis and its cant blend, if you split the pins on both lookat and birds rotation and create two Make Rotator and just wire the Yaw to each its own and use those as Current and Target is it works ok but I find its clitchy still not 100%

Best approach is to not use R Interp for the look at approach and set yaw via our selves.

It requires adding 2 Arrows to the Bird and very little scripting and we calculate yaw smooth as silk, and we wont break no necks no poltergeist here

Here is and example of the technique controlling the skeleton mesh bones manually in a regular BP but the technique is the same

No R Interp
When tracking its smooth but snappy when the new angle is great

R Interp
When tracking its smoothish glitchy but snappy when the new angle is great glitchy Current is fluxing from animation
Another thing about R Interp is that its great for controlling the player from the camera rotator but not good for controlling the player form the player rotator so if you change your self your Current becomes non Constant

R Interp No Animation
Works the best R Interp does great no anim so Current is constant over and over but like the two above approaches DeltaTime has to be accelerate x10 to so if the angle is great its turns so fast it looks like snappy in certain cases

No R Interp Look at V Interp Point Control System
The way to go for sure blends flawless with fluxing from animation

Along with the 2 Arrows “LookAtPoint” and “LookAtPointReturn” you have to change you Tick to this

And add this after you set Yaw on the Anim

I reference Player location but like you had done you can change to camera location if needed
So if its constraint or distance is too great it wont look at a target.

1 Like

Thank you so much. Spent to many hours going through tutorials and coming up empty handed. I also appreciate the explanation on how it works.

1 Like


Thought I had it. Two follow up questions, still having a bit of trouble: is the delta time of the vinterp connected to the delta seconds of the event tick or to the yaw?

And how are the arrows attached to the bird, direction-wise, are they both facing away from the bird or do they need to be the opposite of one another?

I feel like I messed up somewhere in the first part, as it won’t work for me even without the second part connected. Or it has something to do with the arrow.

On the first image, the Start and Target on Find Look at Rotation is swapped But you need to use Birds Location as Start and LookAtPoint as target.

The Arrows are just are used as points and they can point in any direction I just place them in front of the players head both at the same XYZ

Delta time is from tick or the GetWorldDeltaSeconds

In the second image, there are two places I used CurrentLocation and you need to use Birds Location

Ok, so switched out current location with get actor location with the target set as self, set lookat point as target and the location of bird as start. The bird permanently looks away from me. perhaps my blendspace is also wrong? It’s just a simple regular blendspace, I set the yaw variable between -180 and 180. Also no debug lines are showing. If i bypass the first branch and connect straight to the top one i get debug lines, but the bird still doesn’t turn.

Lets get the first part working, Yaw for Blendspace should be -90 to 90 that’s 180 degrees. But Look At Rotation yaw will never give you this Omi Directional place 4 birds facing away from each other yaw will come back different for all 4 this is not what you need, but the base of Look At will the Look At Vector will dot with Forward Vector from -1 to 1 and with * 90 you get -90 to 90

So set Anim Yaw from this and the bird will look at the placed look at point, send me a screenshot of the current not working step 2

This is how it is all currently set up. So this needs to change to get forward vector, instead of? Thank you for being patient.

and this is the reaction of the bird

< 600

The first part look at rotation and combine replace that with the look at vector image I sent. The current setup seems only for a object rotated -90 facing the Y axis

Ok. so, with this, the bird is turning its head toward the camera, and debug lines are drawing, but only when I look to the left of him. So its head is only turning in one direction, then goes back to center.

Have you set Blendspace to -90 to 90?
And move the look at point to the direction that it wont turn break the wire to step 2 till we get this part working.

yep, set to -90 and 90. With the second part disconnected, it doesn’t work at all.

:slight_smile: Part 1 is the part that looks at the lookatpoint, you mentioned it turning left but not right you can test this with moving the look at point to the right or left in the BP and it should look at the point with part2 disabled.

You can print out the yaw when directly in front of bird read 0 and to the birds left 90 and right -90

You can verify the Blend space by hard coding Yaw in step 1, -90 0 90 this will test the blendspace without our math.

Hardcoding the yaw works both 90, 0, and -90. If I do a print string from the yaw with only the first part connected, I get zeros, it doesn’t change. If the second part is connected, I will get values, but they stay bewttn 30-40, and don’t go negative.

Good sign for the Blendspace, don’t go negative that is what happens with the math is backwards

Can you confirm the placement of the two arrows? I have them both about 100 units out in front of the bird

Is what I am using I don’t see any thing different.

If I move the lookat point to left or right without the second part attached it does nothing.

Yes the calculation is not working

Moved the arrows out farther to 100 meters, and it looks to the left without 2nd part attached.

Remote debugging :melting_face:

but if you could put a break point on print string of the yaw variable

And send me the outputs of a few thing like this:

Need to see:
Get world Location of LookAtPoint
Get Actor Location
Get Forward Vector

I had this problem one of these is wrong.