I have been able to create it dynamically without it being in the constructor fine.
I can literally see it with the “show collisions” command but my method doesnt seem to function like the “Add Box Collision” blueprint function.
trying to convert a blueprint into c++ and it uses that node.
The issue is that with the blueprint one it doesnt list the components attached to the actor but it allows for said components to be hit by trace or multi trace functions.
The functionality shown does what it’s supposed to do. If you want to do more then you will need to be more specific about what “function like the ‘Add Box Collision’ blueprint function” actually means.
Do you want to add to the functionality of the editor? Or, do you want to have a blueprint-callable function that will add a box collision to an actor/component at runtime?
I help lots of people and understand them fine. You aren’t explaining yourself clearly. BlueprintCallable lets a blueprint call into C++, and BlueprintImplementable lets C++ call into the blueprint (when implemented). Pick the one you need. But if it’s not calling a C++ function from the blueprint then you’re probably designing it wrong. I assumed you meant expose a C++ function to blueprints because the other way around is kind of dumb unless it’s used to trigger events.
well, i want to replicate the blueprint in c++ as close as possible. So it might just be my frustration of parts of it not working exactly like the blueprint version.
It does have the correct position. It lists itself within the actor, even though with the blueprint version it doesnt. I might try the last function you have listed to see what i can do.
Beyond that, thank you for helping me with this.
So still don´t get what the Problem is? Do they have the Wrong possition? Don´t get hit? Or you want them to be unlisted inside the Actor or registered with the World instead? Whats the deal here? Pinpoint the Problem.
UBoxComponent* BoxComponent = NewObject<UBoxComponent>(GetWorld());
BoxComponent->SetAbsolute(true, true, true); // Transform is Absolute
BoxComponent->SetRelativeTransform(transform);
BoxComponent->SetBoxExtent(size);
// Make sure you setup Collision settings properly etc.
BoxComponent->RegisterComponentWithWorld(GetWorld());
Here’s my last try. This gives your actor a node that is the same as AddBoxCollision. To the best of my abilities, I think that is what you’re asking. Otherwise, good luck. I did my best to understand.