eray_ozr
(eray_ozr)
March 3, 2025, 11:55pm
1
I created a custom UShapeComponent class to spawn custom shaped collisions like this.
// Fill out your copyright notice in the Description page of Project Settings.
#include "Trace/CustomCollision.h"
#include "PhysicsEngine/BodySetup.h"
#include "PhysicsEngine/ConvexElem.h"
#include "Misc/Crc.h"
#include "Engine/Engine.h"
UCustomCollision::UCustomCollision(const FObjectInitializer& ObjectInitializer): Super(ObjectInitializer), CustomBodySetup(nullptr) // Don't create it here; wait until we have a valid World
{
PrimaryComponentTick.bCanEverTick = false;
// Initialize the eight corners based on Default_Extents.
Corners.Empty();
Corners.Add(FVector(-Default_Extents.X, -Default_Extents.Y, -Default_Extents.Z));
Corners.Add(FVector(Default_Extents.X, -Default_Extents.Y, -Default_Extents.Z));
Corners.Add(FVector(Default_Extents.X, Default_Extents.Y, -Default_Extents.Z));
Corners.Add(FVector(-Default_Extents.X, Default_Extents.Y, -Default_Extents.Z));
This file has been truncated. show original
It works but I have a weird problem.
If I change LineThickness
or ShapeColor
with mouse drag in editor before using keyboard, it triggers a crash from this function.
void UStruct::AddCppProperty(FProperty* Property)
{
Property->Next = ChildProperties;
ChildProperties = Property;
}
But If I change their values with keyboard for the first time (or even different class’ property), I don’t have any problem.
Crash video
NoCrash video
What do you think ?