grapplecomponent.h
protected:
virtual void BeginPlay() override;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool m_hooked;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool m_hookfinished;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FVector m_hook_location;
UFUNCTION(BlueprintCallable)
void m_set_visibility(const bool new_visibility, const bool propagate_to_children);
UFUNCTION(BlueprintCallable)
void m_setworldlocation(const FVector& new_location, const bool sweep, const bool teleport, FHitResult& sweep_hit_result);
grapplecomponent.cpp
void Agrapplecomponent:: m_set_visibility(const bool new_visibility, const bool propagate_to_children)
{
}
void Agrapplecomponent::m_setworldlocation(const FVector& new_location, const bool sweep, const bool teleport, FHitResult& sweep_hit_result)
{
}
I have no idea how to change the target of m_setworldlocation and m_set_visibility to scene component like the normal blueprint function does how do I fix this? the stuff that starts with an M are converted to c++
The SetVisibility and SetWorldLocation functions already have a C ++ implementation.
Better to call the entire function from C ++:
//.h
UFUNCTION(BlueprintCallable)
void StopGrapple();
//.cpp
void Agrapplecomponent::StopGrapple()
{
FVector Location(0.f, 0.f, 0.f);
m_hooked = false;
m_hookfinished = false;
GrappleHookCable->SetVisibility(false);
GrappleHookCable->SetWorldLocation(Location);
}
Update
In the Blueprint, change the name of the GrappleHookCable to BlueprintGrappleHookCable. Save and Compile. Close UE.
In {ProjectName}.build.cs add "CustomMeshComponent"
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "UMG", "CustomMeshComponent"});
Character:
//.h
#include "CustomMeshComponent.h"
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly)
UCustomMeshComponent* GrappleHookCable;
//.cpp
Construct
{
GrappleHookCable = CreateDefaultSubobject<UCustomMeshComponent>(TEXT("GrappleHookCable"));
GrappleHookCable->SetupAttachment(GetRootComponent());
}
Compile. Open project. Open Blueprint. Variables -> Components -> Right click "BlueprintGrappleHookCable" -> Replace Reference.
Find "GrappleHookCable" in "Replace with". Turn on "Only show and replace result from ...". Click "Find and Replace References in ..."