Download

C++ including engine files

I couldn’t do blueprints anymore… just too many issues.

My big mission for today is to figure out how to use the methods built into the KismetMathLibrary. More specifically, a dot product of two vectors, Dot_VectorVector.

I have spent the past day trying to figure this out and, while I believe I’ve made some progress, I feel like I’m missing something entirely.

Here’s what I got so far (real simple stuff):

My header:


#pragma once

#include "Object.h"
#include "InwardUtility.generated.h"

UCLASS()
class UInwardUtility : public UObject
{
	GENERATED_UCLASS_BODY()

	UFUNCTION()
	static float PointLineDistance(FVector Point, FVector PlaneOrigin, FVector PlaneNormal);
	
};

My cpp:


#include "Inward.h"
#include "InwardUtility.h"
#include "KismetMathLibrary.h"


UInwardUtility::UInwardUtility(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	
}

static float PointLineDistance(FVector Point, FVector PlaneOrigin, FVector PlaneNormal)
{
	return UKismetMathLibrary::Dot_VectorVector(UKismetMathLibrary::Subtract_VectorVector(Point, PlaneOrigin), PlaneNormal);
}

My current error:


1>Inward.generated.cpp.obj : error LNK2019: unresolved external symbol "public: static float __cdecl UInwardUtility::PointLineDistance(class FVector,class FVector,class FVector)" (?PointLineDistance@UInwardUtility@@SAMVFVector@@00@Z) referenced in function "public: void __cdecl UInwardUtility::execPointLineDistance(struct FFrame &,void * const)" (?execPointLineDistance@UInwardUtility@@QEAAXAEAUFFrame@@QEAX@Z)
1>C:\Users\...\Documents\Unreal Projects\Inward\Binaries\Win64\UE4Editor-Inward.dll : fatal error LNK1120: 1 unresolved externals

If anyone has any ideas, I really appreciate it and sorry if this is way stupid.

You declared the function as static member of UInwardUtility class but implemented it as “usual” function.


static float PointLineDistance(FVector Point, FVector PlaneOrigin, FVector PlaneNormal)

should be(in your cpp)


static float UInwardUtility::PointLineDistance(FVector Point, FVector PlaneOrigin, FVector PlaneNormal)

Why not use


FVector::DotProduct(Point - PlaneOrigin, PlaneNormal)

?

@BiggestSmile, Zeblote:

Both of your replies helped greatly, thank you ::smiley: