Had to split this, since it was too long… Here is the code:
Make a header file called MyNewBPFunctionLibrary.h:
#pragma once
#include "MyNewBPFunctionLibrary.generated.h"
UCLASS()
class UMyNewBPFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_UCLASS_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "MyNewFunctions")
static void TeleportPhysicsBody(USkeletalMeshComponent* Mesh, const FVector& NewLocation, const FRotator& NewRotation);
}
And in your cpp file (MyNewBPFunctionLibrary.cpp). Note whatever you call your game, thats what YourGameModule should be.
#include "YourGameModule.h"
#include "MyNewFunctionLibrary.h"
UMyNewFunctionLibrary::UMyNewFunctionLibrary(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
void UMyNewFunctionLibrary::TeleportPhysicsBody(USkeletalMeshComponent* Mesh, const FVector& NewLocation, const FRotator& NewRotation)
{
Mesh->SetAllPhysicsPosition(NewLocation);
Mesh->SetAllPhysicsRotation(NewRotation);
}