What's wrong with implementing Accelaration

I just try for Acceleration

Under Tick()

void AVRCharacter::Accelaration()
{
if (VRCharacter->GetCharacterMovement()->GetCurrentAcceleration().Size() > 0.0f)
{
BlinkerMaterialBase;
}

}

HEADER files

#include “VRCharacter.h”
#include “Components/InputComponent.h”
#include “Camera/CameraComponent.h”
#include “Components/SceneComponent.h”
#include “Components/StaticMeshComponent.h”
#include “Engine/World.h”
#include “Camera/PlayerCameraManager.h”
#include “TimerManager.h”
#include “NavigationSystem.h”
#include “Components/PostProcessComponent.h”
#include “Materials/MaterialInstanceDynamic.h”
#include “GameFramework/CharacterMovementComponent.h”

when i called my function Accelaration()
in Tick ()

void AVRCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

  Accelaration();

}

unreal engine send me the crash report by mentioning Accelaration(); in Super::Tick(DeltaTime);

What you have is chaining of calls where a number of items could potentially return nullptr as a result and this will crash the editor.

VRCharacter->GetCharacterMovement()->GetCurrentAcceleration().Size()

VRCharacter could be a nullptr, and the result of GetCharacterMovement as well. Get Current Acceleration because it uses a . should be fine - I am assuming this is an FVector being returned from it. You really have to check for nullptrs

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms