Dear Friends at Epic,
I’ve been happily using a custom character movement all the way through 4.1.1.
But in 4.2 I’ve now noticed that using the traditional method (first recommended by James G during the Beta, now the CharacterMovement ptr of the Character class becomes invalid!
Even if I manage to access my custom character movement component, which does exist in the world, the Character ignores all movement imput because its CharacterMovement ptr is null!
#So there’s literally nothing I can do with custom character movement until this bug is addressed
Here’s the method I am using:
#Character Class
//////////////////////////////////////////////////////////////////////////
// AJoyShapesCharacterBase
AJoyShapesCharacterBase::AJoyShapesCharacterBase(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP.SetDefaultSubobjectClass<UJoyMoveComp>(ACharacter::CharacterMovementComponentName))
{
}
void AJoyShapesCharacterBase::PostInitializeComponents()
{
Super::PostInitializeComponents();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Joy Move Comp
//Set PC for Move Comp
JoyMove = Cast<UJoyMoveComp>(CharacterMovement);
if(JoyMove)
{
JoyMove->VictoryPC = VictoryPC;
}
//No char movement?!?!?!
if(!CharacterMovement)
{
UE_LOG(Joy,Error,TEXT("THE CHARACTERMOVEMENT COMP IS INVALID"));
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
/*
By Rama
*/
#pragma once
#include "JoyMoveComp.generated.h"
class AJoyShapesPC;
UCLASS()
class UJoyMoveComp : public UCharacterMovementComponent
{
GENERATED_UCLASS_BODY()
//Core
public:
//Tick
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) OVERRIDE;
};
#Custom Character Movement Class
/*
By Rama
*/
#include "JoyShapes.h"
#include "JoyMoveComp.h"
//////////////////////////////////////////////////////////////////////////
// UJoyMoveComp
UJoyMoveComp::UJoyMoveComp(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
//Tick Comp
void UJoyMoveComp::TickComponent(
float DeltaTime,
enum ELevelTick TickType,
FActorComponentTickFunction *ThisTickFunction
){
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UE_LOG(Joy, Error, TEXT("Ticking!!!")); //<--- This is working!
}
#What Logs Show
My Logs show that the CharacterMovement ptr from the Character.h class itself is indeed invalid after Post Init.
My logs also show that the custom CharacterMovement Component IS actually ticking!
#Analysis
Somehow the CharacterMovement ptr is no longer getting updated to the new custom CharacterMovement Comp as of 4.2
This makes things very difficult and also makes the CanJump CPP override crash instantly.
#CanJump() crashes the game since no CharacterMovement ptr
//USEING CUSTOM MOVE COMP MAKES THIS CRASH!!!
//REPORT IF STILL CRASH PRESENT AFTER 4.3 !!!!!
/*
bool AJoyMovement::CanJumpInternal_Implementation() const
{
return true; // !IsHovering();
}
*/
#Help!
Help!
#Related Thread
Rama