# Getting the world position of skeletal mesh vertex

**URL:** <https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765>\
**Category:** World Creation\
**Tags:** physics-constraint, vertex-position, unreal-engine, Physics, skeletalmesh, CPP, question\
**Created:** [March 2, 2017, 10:33pm UTC](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765 "2017-03-02T22:33:20Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![FunnyCharly](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/funnycharly/32/953985_2.png) [@FunnyCharly](https://forums.unrealengine.com/u/FunnyCharly)\
**Post date:** [June 12, 2023, 7:52am UTC](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765/25 "2023-06-12T07:52:02Z")

</div>

So sorry to hear that. 🥲

---

<div class="post-metadata">

**Author:** ![BojanglesTheLess](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BojanglesTheLess](https://forums.unrealengine.com/u/BojanglesTheLess)\
**Post date:** [August 9, 2023, 8:04am UTC](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765/26 "2023-08-09T08:04:14Z")

</div>

WOW  
This is awesome, thanks for sharing. It works in UE5, you just need to change a few variable types.

---

<div class="post-metadata">

**Author:** ![jayraj2610](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jayraj2610/32/1067269_2.png) [@jayraj2610](https://forums.unrealengine.com/u/jayraj2610)\
**Post date:** [August 23, 2023, 8:58am UTC](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765/27 "2023-08-23T08:58:03Z")

</div>

can you share Which varibale type to change  
its related to cons but i cant get it to Work

---

<div class="post-metadata">

**Author:** ![vigil1917](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vigil1917](https://forums.unrealengine.com/u/vigil1917)\
**Post date:** [January 13, 2024, 9:48am UTC](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765/28 "2024-01-13T09:48:13Z")

</div>

I am trying to do the same thing, did you solve it? 🥲

---

<div class="post-metadata">

**Author:** ![vigil1917](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vigil1917](https://forums.unrealengine.com/u/vigil1917)\
**Post date:** [January 15, 2024, 3:30am UTC](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765/29 "2024-01-15T03:30:04Z")

</div>

Can you share the UE5 version of this plugin please? That would be so nice of you. I straggled for quite some time but still failed…

---

<div class="post-metadata">

**Author:** ![J\_Escape](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@J\_Escape](https://forums.unrealengine.com/u/J_Escape)\
**Post date:** [May 25, 2024, 2:35pm UTC](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765/31 "2024-05-25T14:35:14Z")

</div>

bump! Has anyone figured out the change needed for UE5 by chance?

---

<div class="post-metadata">

**Author:** ![J\_Escape](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@J\_Escape](https://forums.unrealengine.com/u/J_Escape)\
**Post date:** [June 9, 2024, 4:05am UTC](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765/32 "2024-06-09T04:05:21Z")

</div>

Got it working in 5.4

```auto

#include "Rendering/SkeletalMeshRenderData.h"
#include "Engine/SkeletalMesh.h"
#include "SkeletalRenderPublic.h"

bool UCustomBP_Library::BP_GetSkeletalMeshVertexLocations(USkeletalMeshComponent* Mesh, TArray<FVector>& Locations, int32 LODIndex)
{
    if (!Mesh || !Mesh->GetSkeletalMeshAsset())
    {
        return false;
    }

    const FSkeletalMeshRenderData* RenderData = Mesh->GetSkeletalMeshRenderData();
    if (!RenderData)
    {
        return false;
    }

    const FSkeletalMeshLODRenderData& LOD = RenderData->LODRenderData[LODIndex];
    const FSkinWeightVertexBuffer& Buffer = LOD.SkinWeightVertexBuffer;
    TArray<FMatrix44f> CacheToLocals;
    Mesh->GetCurrentRefToLocalMatrices(CacheToLocals, LODIndex);

    if (Mesh->GetCPUSkinningEnabled())
    {
        // CPU skinning
        TArray<FFinalSkinVertex> SkinnedVertices;
        Mesh->GetCPUSkinnedVertices(SkinnedVertices, LODIndex);
        Locations.Empty();
        Locations.AddUninitialized(SkinnedVertices.Num());
        for (int32 i = 0; i < SkinnedVertices.Num(); ++i)
        {
            Locations[i] = FVector(SkinnedVertices[i].Position);
        }
    }
    else
    {
        // GPU skinning
        TArray<UE::Math::TVector<float>> SkinnedPositions;
        Mesh->ComputeSkinnedPositions(Mesh, SkinnedPositions, CacheToLocals, LOD, Buffer);
        Locations.Empty();
        Locations.AddUninitialized(SkinnedPositions.Num());
        for (int32 i = 0; i < SkinnedPositions.Num(); ++i)
        {
            Locations[i] = FVector(SkinnedPositions[i]);
        }
    }

    // Transform local positions to world positions
    const FTransform ToWorld = Mesh->GetComponentTransform();
    for (FVector& EachVertex : Locations)
    {
        EachVertex = ToWorld.TransformPosition(EachVertex);
    }

    return true;
}

void UCustomBP_Library::BP_SetCPUSkinningEnabled(USkinnedMeshComponent* Mesh, bool bEnable, bool bRecreateRenderStateImmediately)
{
    Mesh->SetCPUSkinningEnabled(bEnable, bRecreateRenderStateImmediately);
}

```

[Previous page](https://forums.unrealengine.com/t/getting-the-world-position-of-skeletal-mesh-vertex/386765.md?page=1)
