I would like to start off by saying I converted my project from 4.11 to 4.12, and I am unable to build the project in VS due to an error created in a projectile class.
These are the two errors I am getting that reference the projectile class. As you can see the errors are complaining about line 14. I’ve googled the errors and haven’t really been able to come up with anything useful.
Error (active) no instance of function template "FComponentHitSignature::__Internal_AddDynamic" matches the argument list ProjectInfinite c:\Perforce\GatewayEntertainment\ProjectInfinite 4.12\Source\ProjectInfinite\ProjectInfiniteProjectile.cpp 14
Error C2664 'void TBaseDynamicMulticastDelegate<FWeakObjectPtr,void,UPrimitiveComponent *,AActor *,UPrimitiveComponent *,FVector,const FHitResult &>::__Internal_AddDynamic<AProjectInfiniteProjectile>(UserClass *,void (__cdecl AProjectInfiniteProjectile::* )(UPrimitiveComponent *,AActor *,UPrimitiveComponent *,FVector,const FHitResult &),FName)': cannot convert argument 2 from 'void (__cdecl AProjectInfiniteProjectile::* )(AActor *,UPrimitiveComponent *,FVector,const FHitResult &)' to 'void (__cdecl AProjectInfiniteProjectile::* )(UPrimitiveComponent *,AActor *,UPrimitiveComponent *,FVector,const FHitResult &)' ProjectInfinite C:\Perforce\GatewayEntertainment\ProjectInfinite 4.12\Source\ProjectInfinite\ProjectInfiniteProjectile.cpp 14
This is all of the code.
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "ProjectInfinite.h"
#include "ProjectInfiniteProjectile.h"
#include "GameFramework/ProjectileMovementComponent.h"
AProjectInfiniteProjectile::AProjectInfiniteProjectile()
{
// Use a sphere as a simple collision representation
CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
CollisionComp->InitSphereRadius(5.0f);
CollisionComp->BodyInstance.SetCollisionProfileName("Projectile");
CollisionComp->OnComponentHit.AddDynamic(this, &AProjectInfiniteProjectile::OnHit); // set up a notification for when this component hits something blocking
// Players can't walk on it
CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
CollisionComp->CanCharacterStepUpOn = ECB_No;
// Set as root component
RootComponent = CollisionComp;
// Use a ProjectileMovementComponent to govern this projectile's movement
ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
ProjectileMovement->UpdatedComponent = CollisionComp;
ProjectileMovement->InitialSpeed = 3000.f;
ProjectileMovement->MaxSpeed = 3000.f;
ProjectileMovement->bRotationFollowsVelocity = true;
ProjectileMovement->bShouldBounce = true;
// Die after 3 seconds by default
InitialLifeSpan = 3.0f;
}
void AProjectInfiniteProjectile::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
// Only add impulse and destroy projectile if we hit a physics
if ((OtherActor != NULL) && (OtherActor != this) && (OtherComp != NULL) && OtherComp->IsSimulatingPhysics())
{
OtherComp->AddImpulseAtLocation(GetVelocity() * 100.0f, GetActorLocation());
Destroy();
}
}