You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UETOOL-3823 #rb ryan.schmidt #preflight 6101fb4b2b002800014f7007 #ROBOMERGE-SOURCE: CL 17003092 in //UE5/Main/... #ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207) [CL 17003151 by michael balzer in ue5-release-engine-test branch]
71 lines
2.0 KiB
C++
71 lines
2.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Physics/CollisionPropertySets.h"
|
|
#include "Physics/PhysicsDataCollection.h"
|
|
|
|
#include "Engine/Classes/PhysicsEngine/BodySetup.h"
|
|
|
|
void UE::PhysicsTools::InitializePhysicsToolObjectPropertySet(const FPhysicsDataCollection* PhysicsData, UPhysicsObjectToolPropertySet* PropSet)
|
|
{
|
|
check(PhysicsData);
|
|
check(PropSet);
|
|
|
|
PropSet->ObjectName = FString::Printf(TEXT("%s - %s"),
|
|
*PhysicsData->SourceComponent->GetOwner()->GetName(),
|
|
*PhysicsData->SourceComponent->GetName());
|
|
|
|
PropSet->CollisionType = (ECollisionGeometryMode)(int32)PhysicsData->BodySetup->GetCollisionTraceFlag();
|
|
|
|
// change object name to above
|
|
//PropSet->Rename(*PropSet->ObjectName, nullptr, REN_NonTransactional | REN_ForceNoResetLoaders | REN_DoNotDirty);
|
|
|
|
const FKAggregateGeom& AggGeom = PhysicsData->AggGeom;
|
|
|
|
for (const FKSphereElem& Sphere : AggGeom.SphereElems)
|
|
{
|
|
FPhysicsSphereData SphereData;
|
|
SphereData.Radius = Sphere.Radius;
|
|
SphereData.Transform = Sphere.GetTransform();
|
|
SphereData.Element = Sphere;
|
|
PropSet->Spheres.Add(SphereData);
|
|
}
|
|
|
|
for (const FKBoxElem& Box : AggGeom.BoxElems)
|
|
{
|
|
FPhysicsBoxData BoxData;
|
|
BoxData.Dimensions = FVector(Box.X, Box.Y, Box.Z);
|
|
BoxData.Transform = Box.GetTransform();
|
|
BoxData.Element = Box;
|
|
PropSet->Boxes.Add(BoxData);
|
|
}
|
|
|
|
for (const FKSphylElem& Capsule : AggGeom.SphylElems)
|
|
{
|
|
FPhysicsCapsuleData CapsuleData;
|
|
CapsuleData.Radius = Capsule.Radius;
|
|
CapsuleData.Length = Capsule.Length;
|
|
CapsuleData.Transform = Capsule.GetTransform();
|
|
CapsuleData.Element = Capsule;
|
|
PropSet->Capsules.Add(CapsuleData);
|
|
}
|
|
|
|
for (const FKConvexElem& Convex : AggGeom.ConvexElems)
|
|
{
|
|
FPhysicsConvexData ConvexData;
|
|
ConvexData.NumVertices = Convex.VertexData.Num();
|
|
ConvexData.NumFaces = Convex.IndexData.Num() / 3;
|
|
ConvexData.Element = Convex;
|
|
PropSet->Convexes.Add(ConvexData);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void UPhysicsObjectToolPropertySet::Reset()
|
|
{
|
|
ObjectName = TEXT("");
|
|
Spheres.Reset();
|
|
Boxes.Reset();
|
|
Capsules.Reset();
|
|
Convexes.Reset();
|
|
} |