Thanks Rama I ended up doing this:
// Create the Launch Impulse Vector.
FVector LaunchImpulse = FVector(ScreenEdgeImpulse, ScreenEdgeImpulse, 0.0f);
// Get the Rotator that we want to rotate the Impulse by for each mesh.
FRotator RotateLightWisp = FRotationMatrix::MakeFromX(DarkWispLoc - LightWispLoc).Rotator();
FRotator RotateDarkWisp = FRotationMatrix::MakeFromX(-DarkWispLoc + LightWispLoc).Rotator();
//FRotator RotateLightWisp = UKismetMathLibrary::FindLookAtRotation(DarkWispLoc, LightWispLoc);
//FRotator RotateDarkWisp = UKismetMathLibrary::FindLookAtRotation(LightWispLoc, DarkWispLoc);
// Rotate the launch vector by the rotation
FVector LightWispLaunchImpulse = FRotator(RotateLightWisp).RotateVector(LaunchImpulse);
FVector DarkWispLaunchImpulse = FRotator(RotateDarkWisp).RotateVector(LaunchImpulse);
LightWispMesh->AddImpulse(LightWispLaunchImpulse, NAME_None, true);
DarkWispMesh->AddImpulse(DarkWispLaunchImpulse, NAME_None, true);
My next question is… why can I not get input from the keyboard for whatever reason?
void AWispPawn::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
//FVector RepulsionImpulse = (WispRepulsionImpulse, WispRepulsionImpulse, 0.0f);
FVector DarkWispLoc = (DarkWispMesh->GetComponentLocation());
FVector LightWispLoc = (LightWispMesh->GetComponentLocation());
// Check to see if we are too far apart already.
if (DistanceBetweenWisps() > 3200.0f)
{
// Create the Launch Impulse Vector.
FVector LaunchImpulse = FVector(ScreenEdgeImpulse, ScreenEdgeImpulse, 0.0f);
// Get the Rotator that we want to rotate the Impulse by for each mesh.
FRotator RotateLightWisp = FRotationMatrix::MakeFromX(DarkWispLoc - LightWispLoc).Rotator();
FRotator RotateDarkWisp = FRotationMatrix::MakeFromX(-DarkWispLoc + LightWispLoc).Rotator();
//FRotator RotateLightWisp = UKismetMathLibrary::FindLookAtRotation(DarkWispLoc, LightWispLoc);
//FRotator RotateDarkWisp = UKismetMathLibrary::FindLookAtRotation(LightWispLoc, DarkWispLoc);
// Rotate the launch vector by the rotation
FVector LightWispLaunchImpulse = FRotator(RotateLightWisp).RotateVector(LaunchImpulse);
FVector DarkWispLaunchImpulse = FRotator(RotateDarkWisp).RotateVector(LaunchImpulse);
LightWispMesh->AddImpulse(LightWispLaunchImpulse, NAME_None, true);
DarkWispMesh->AddImpulse(DarkWispLaunchImpulse, NAME_None, true);
}
else
{
// Set World Location Of Light Wisp Depending on Inputs.
FVector LightLocalMove = FVector();
LightLocalMove.X = (CurrentLightForwardSpeed * MovementSpeed) * DeltaSeconds;
LightLocalMove.Y = (CurrentLightRightSpeed * MovementSpeed) * DeltaSeconds;
LightWispMesh->SetWorldLocation(LightLocalMove, true);
FVector DarkLocalMove = FVector();
DarkLocalMove.X = (CurrentDarkForwardSpeed * MovementSpeed) * DeltaSeconds;
DarkLocalMove.Y = (CurrentDarkRightSpeed * MovementSpeed) * DeltaSeconds;
DarkWispMesh->SetWorldLocation(DarkLocalMove, true);
}
// Move Camera To Correlate to new World Positions.
float NewCameraHeight = FMath::Clamp(DistanceBetweenWisps(), CameraMinHeight, CameraMaxHeight);
FVector AddCamLoc = FVector(0.0f, 0.0f, NewCameraHeight);
FVector NewCamLocation = MidpointBetweenWisps() + AddCamLoc;
TopDownCamera->SetWorldLocation(FVector(NewCamLocation), true);
}
void AWispPawn::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
check(InputComponent);
// Fine Up and Right Axes for Light Wisp.
InputComponent->BindAxis("LightMoveForward", this, &AWispPawn::LightWispForward);
InputComponent->BindAxis("LightMoveRight", this, &AWispPawn::LightWispRight);
// Find input for dark wisp.
InputComponent->BindAxis("DarkMoveForward", this, &AWispPawn::DarkWispForward);
InputComponent->BindAxis("DarkMoveRight", this, &AWispPawn::DarkWispRight);
}
void AWispPawn::LightWispForward(float val)
{
CurrentLightForwardSpeed = val;
}
void AWispPawn::LightWispRight(float val)
{
CurrentLightRightSpeed = val;
}
void AWispPawn::DarkWispForward(float val)
{
CurrentDarkForwardSpeed = val;
}
void AWispPawn::DarkWispRight(float val)
{
CurrentDarkRightSpeed = val;
}
I’ve setup my inputs in the config file properly, but for whatever reason this won’t work