Hey! I was wondering if I can manipulate the Mesh like I can in Blueprint (adjusting its size, position and rotation like I could with a blueprint mesh component). Just asking, because I really prefer using C++ and am not to keen into learning how to use Blueprint only to use it a few times for Mesh components.
Here is my script:
/** Mesh component in the head script */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Mesh)
TSubobjectPtr < class UStaticMeshComponent> MeshComp;
// Create the mesh component (in the execution script)
MeshComp = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Collectable"));
MeshComp->SetOnlyOwnerSee(false); // all players will see this meshs
MeshComp->bCastDynamicShadow = true;
MeshComp->CastShadow = true;
What you want is SceneComponent.h! (A Mesh Component is a Scene Component)
/** Set the location of this component relative to its parent */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void SetRelativeLocation(FVector NewLocation, bool bSweep=false);
/** Set the rotation of this component relative to its parent */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void SetRelativeRotation(FRotator NewRotation, bool bSweep=false);
/** Set the transform of this component relative to its parent */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void SetRelativeTransform(const FTransform& NewTransform, bool bSweep=false);
/** Returns the transform of this component relative to its parent */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
FTransform GetRelativeTransform();
/** Set the transform of this component relative to its parent */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void ResetRelativeTransform();
/** Set the non-uniform of this component relative to its parent */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void SetRelativeScale3D(FVector NewScale3D);
/** Adds a delta to the translation of this component relative to its parent */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void AddRelativeLocation(FVector DeltaLocation, bool bSweep=false);
/** Adds a delta the rotation of this component relative to its parent */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void AddRelativeRotation(FRotator DeltaRotation, bool bSweep=false);
#World Space
The above are in Relative Space relative to Parent
You can also set World Space location and rotation
/** Set the relative location of this component to put it at the supplied location in world space. */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void SetWorldLocation(FVector NewLocation, bool bSweep=false);
/** Set the relative rotation of this component to put it at the supplied orientation in world space. */
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void SetWorldRotation(FRotator NewRotation, bool bSweep=false);
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
void SetWorldScale3D(FVector NewScale);
UFUNCTION(BlueprintCallable, Category="Utilities|Orientation")
/** Set the transform of this component in world space. */
void SetWorldTransform(const FTransform& NewTransform, bool bSweep=false);