Creating simple physic objects at runtime - Are there tutorials around?

Hello Community,

Currently having the feeling that I’ve quite overestimated myself…
I’m working on the project mentioned here which is due in about 2.5 months: Can the UE be used efficiently for pure physics simulations? - World Creation - Epic Developer Community Forums

Unfortunately it’s the first time I’m using the UE and everything seems very non-intuitive.

The thing is, I need to create many constructions of physic-instances (simple cuboids/scaled-cubes) attached to each-other with various constraints.
However, those constructions need to differ and to be created at runtime with computed values - so I cannot use the editor or blueprints and have to do everything in C++. Or am I wrong about this assumption?

Could someone redirect me to a proper tutorial or example which shows how objects are created and attached in C++?

The only thing I could find was this tutorial: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
I’m working since more two hours on it but cannot get anything compile-able, not to mention anything working…
An actual project example would be so much better.

TDLR: What do I need to create a few attached cuboids with physics in a simple BeginPlay() event?

Hope someone here around could be so friendly to give me a push in the right direction… :slight_smile:
Huge thanks in Advance!

Could you explain(/give an example) about what kind of “computed values” you mean? because it sounds like it can be easily done with blueprints :slight_smile: (are we talking about simply attaching a few cubes together or…? :p)

It should be fairly easy to attach physics objects together at runtime by spawning physics handles and/or constraints components without having to use C++ (but if you do need to do it from C++ then you should already have what you need from Rama’s tutorial(s), perhaps you are trying to dive too deep too soon? :p).

Thank you for responding :slight_smile:

Well, as described in that other thread, I’m trying to use UE for repetitive physic simulations.
That means I will create a basic concept out of a cube in the center and two lines of cuboids attached to the main cube through constraint and or actors.

The values I mean are the details and settings of all those constrains as well as optionally the size of the cuboids. So at runtime, the final system will create several of those basic concepts bit with differing values. For example one will have very strong/narrow constrains while another has weaker ones and so on.

Well, that could be it… but just not really sure how to get into the thing without learning the “whole” UE since I definitely don’t have the time for that.

Well I mean… to attach a few cubes together using physics constraints can be as simple as this in blueprint:


This will spawn and attach 2 cubes together, the same nodes can be used to attach as many as needed.
And you can set the constraints parameters, in the image above I simply set the swing limits to Locked (all in runtime).

Quick test video (for funzies :p)

Ohh, wow, you did that with the video just for me? O:
I feel very honored! :slight_smile:

Hmm, interesting, but still I’m unsure whether that suffices for what I need. The core of my project will be the intelligent algorithm after all.
That one will be definitely written in C++ and compute the values for all the constraints, so I cannot hardcode the constraints into the editor!
Or is it possible to create a sort of template with blueprint and then execute that blueprint through C++ with arguments as if the blueprint were a function and the values its arguments?
That would be perfect, but from what I’ve seen so far, that’s not how blueprints work…