CommonLibF4 icon indicating copy to clipboard operation
CommonLibF4 copied to clipboard

[Question] Head world position

Open dlinny-lag opened this issue 2 years ago • 3 comments

I'm writing UI plugin and trying to display UI widget near to actor's head position. I've tried to use TESObjectREFR::Get3D() and TESObjectREFR::GetFaceNodeSkinned. Both returns NiAVObject that points to "feets" of actor's model when actor is staying, but points to the center (approximately) of model when actor is lying down.

Do you have any idea how to obtain actor's head world position?

dlinny-lag avatar Dec 28 '21 14:12 dlinny-lag

I would look at Actor::GetEyeVector

Ryan-rsm-McKenzie avatar Dec 28 '21 20:12 Ryan-rsm-McKenzie

Thanks. But it seems usless for my purposes An example of coordinates:

staying

world pos {-35234.382813, 41025.136719, 3220.069824}
eye pos   {-35234.382813, 41025.136719, 3324.390869}

Z diff is about 124

lying down

world pos {-35461.015625, 40947.492188, 3219.156006}
eye pos   {-35461.015625, 40947.492188, 3323.477051}

Z diff is about 124 too

dlinny-lag avatar Dec 29 '21 09:12 dlinny-lag

ok, I guess I've found solution

  1. Get NiAVObject by TESObjectREFR::Get3D. It should be NiNode actually
  2. Recursively find NiAVObject for Head in it. In my case it was [/Root/COM_Override/COM/SPINE1/SPINE2/Chest/Neck/Head]

An example coordinates: staying actor:

                                             world pos {-34596.410156, 40947.843750, 3213.797119}
                                               eye pos {-34596.410156, 40947.843750, 3324.402100}
[/Root/COM_Override/COM/SPINE1/SPINE2/Chest/Neck/Head]:{-34596.074219, 40958.359375, 3324.402100}

laying down actor:

                                             world pos {-35461.015625, 40947.492188, 3219.156006}
                                               eye pos {-35461.015625, 40947.492188, 3329.760986}
[/Root/COM_Override/COM/SPINE1/SPINE2/Chest/Neck/Head]:{-35486.519531, 40915.753906, 3260.565430}

dlinny-lag avatar Dec 29 '21 11:12 dlinny-lag