• News

• Industries

• Learning & Support

• Community

• Marketplace

# Eye contact

Hey,

Has anyone managed to make NPC eyes follow the Rift properly, i managed to make the eyes follow the character with “Find Look At Rotation” and added the HMD node “Get Orientation And Position” to add the HMD vectors to that, the blueprint got really complicated and it works but i’m still having some issues, i’m not sure if i’m over-complicating things and if there is a good method to achieve that, i want NPC eyes to follow the Rift no matter the NPC’s orientation and no matter the rift’s orientation and have a relative clamping so that eyes never rotate too far

I’m almost there but right now pulling my head back makes the Actors go cross eyes, something got inverted somewhere, there is a lot of inverted stuff, sometime pitch is actually roll and so on, this is getting really confusing

The graph looks like this so far

I just wanted to add more details,

Setting up the “Find Look At Rotation” works perfectly, eyes follow me wherever i am without any issues by moving my character around

As soon as i add the positional tracking vectors the first thing i notice is that X and Y seem inverted, pulling my head back and forth make the NPC’s eyes move left and right, so i assume that the “Get Orientation And Position” Node isn’t working properly, by breaking the vector and by switching X and Y it works

But it only works for an NPC that has its rotation to 0,0,0, so if an NPC is rotated around on the Z axis let’s say by 90, my HMD vectors have to rotate too, so i add a “Get Actor Rotation Node” and add it to a “Rotate Vector Node” so that my vectors are inheriting the NPC’s orientation

Then i noticed that if i am not facing the NPC but turn my head to face him with the HMD’s rotation, the vectors are still facing my true character’s orientation, so i add another “Rotate Vector Node” and send the Orientation output from “Get Orientation And Position” to that, this way the vectors are following my HMD rotation

Still after all that i’m getting some strange issues and this all seems overly complicated to me, isn’t there a simpler way to get Actors/Components to properly follow the Rift’s orientation and position?

wow i do that with alot less nodes, with that screenshot hard to see what do you do for need that all.

but one problem i have first time was ‘actor location’ its the root, then you NPC are looking to your pelvis with “Find Look”, when you are near they face going down because of this.

that not work if you want eye contact, cost me few hours realice that because i think was something about invert axis (because when i near NPC must lift the head not lower) or something strange. :mad:
I use then “Trace Line” for check what “Find Look” are doing and realice that, my NPC are looking to my root/pelvis that why NPC lower the head.

I got all working fine but can’t give a screenshot ATM.

What i did so the actors look at me in the eyes was break the Actor Location vector and add height to the Z vector to match the camera location

What i did so the actors look at me in the eyes was break the Actor Location vector and add height to the Z vector to match the camera location

So you say you have achieved that with a lot less nodes, Actors are following the positional and rotational tracking perfectly?

I’d like to know what method you use

counting ALL nodes (including [x] -] nodes) , 18 nodes and two variables. 8 nodes after “Find look rotation”

and yes works fine.

I place a socket in the head and move to midle of the NPC eyes, then i get the socket position. I don’t known if its the best way but works too…

if you submit a better screenshot and a video of problems i try help you.

I initially used a simple sphere component between the two eyes, but decided that it was best to use two Find Look At Rotation starting precisely at each eye center to get realistic and precise results, also this is why my graph is bigger

What method did you use to send the Rift positional + rotation tracking to the Find Look At Rotation target?

“Get Orientation And Position” outputs both Position and Rotation values I’ve found to be in it’s own local basis - in the HMD tracking volume space, not world space. This means the world rotation and position of your player pawn isn’t taken into account with this node.

So to find the true HMD world position:

1. Plug “Get Device Position” output from the “Get Orientation and Position” node, into a “Rotate Vector” node’s position input,
2. Add two nodes, “Get Player Pawn” > “Get Control Rotation” > and plug the result into the Rotate Vector’s rotation pin.
3. Then setup these two nodes for the pawn’s camera location: “Get Player Camera Manager” > “Get Camera Location”.
4. Using an “Vector Addition” node, add outputs of step 2 & 3.

This results a final vector representing an accurate world location of the HMD. I use this to build look-at triggers and etc. I think if your NPC uses a “Find look at rotation” to that vector then your NPC should appear to do what you want.

“Get Orientation And Position” node isn’t broken, it’s purpose is when you want to do things like check how far the player is turning their head or looking up, or leaning forward, etc, I assume people use this to drive head animations on the player pawn.

Thanks, i’m going to look at your solution in details right away, it sounds very similar to what i have done

Another thing is the clamping, eyes need to clamp so they don’t rotate unnaturally, but i found setting up a clamping angle didn’t follow the Actors as they rotated around, what i did was get the Actor rotation and add that to the clamping min and max, it seems to work but again i’m not sure i’m doing things the best way

Thanks again for the replies everyone

Thanks wes h

Your method seem to have fixed the inverted vectors from “Get Orientation And Position” helping me to simplify the graph

I’m going to clean things up and try to get this working properly and report back

Good to hear! Really this setup seems like a useful BP node Epic (or Rama!) should put into standard UE4!

Here what the graph looks like now (without clamp) and with a single point between both eyes for the eyes location

I noticed that even with what you suggested if i looked at characters by turning my head to the side with my body facing the other way, the vectors would be facing my body position so the eyes didn’t follow properly, i did the same thing that i mentioned earlier, add a second Rotate Vector and send the HMD rotation from “Get Orientation And Position” to that

Also i’m still having an inverted Pitch/Roll and a Yaw that is off by 90 degrees, it’s easily fixed but i’m not sure why this is happening

The first graph that i posted earlier looks overly complicated because a lot of vectors were broken down for debunking purposes

Now i need to set up clamping angles that is relative to the Actors

Here is how i clamp the Yaw rotation and make the clamp follow the NPC’s orientation, again i’d like to know if this is a proper method , it seems to work but i’m still having some strange behaviors

No.

You must do yaw(find) - yaw(actor rotation) and then clamp

For clamp its
Yaw result to Clamp(Value) Min-40] Max[40] (not use + node)

that how i do that if i remember right now.

No matter what i do it looks like Clamp is clamping every Actors in the same direction, if i put -40 40, every actors in the game have their Yaw clamped on the Z axis at -40 40 degrees, the only way that i managed to get this working is by adding the Actors rotation value to Min and Max like on my screenshot above, no matter what i send to the Clamp Value input everything is clamped the same way

I’m probably doing something wrong, but thanks for the help

sorry i not understand well (because i think my bad english) what your problem, a video must help.

No problem

My method just doesn’t work well, as soon as i look down or rotate my head in a non horizontal position the eyes go crazy, i’m still not good enough with Blueprint to come up with a good method, in my mind it sounds really simple, get the location of the camera + HMD positional tracking at point and tell the Actors to always face that location, i think i’m giving up for now

Back to my other projects, thanks all for the help

its near impossible known where are you failing with the code without known how you are doing that and the bp code. You must fix yourself.
Sometimes its good do other things, and few days go back to the problem.

KhenaB, could you solve this? I’m struggling with the same problem (I tried to solve it with vectors, dot products, acos).
Basically I’m trying to transform the world space rotator from “find look at rotation” to a bone space rotator (so I can easily clamp it to -40/+40 degrees for looking up/down).