How to spawn a cube attached to another(so they stick together) with blueprints

Hello,
I would like to know how to spawn a blueprint Class so the static mash sticks and shares physics with the neibor mesh, or maybe use one class that extends it’s hitbox and mesh (in blueprint if possible) thanks :slight_smile:

btw, just wondering what is the range of a float in ur4?
Thanks for yours answears :slight_smile:

You could spawn inside the blueprint a new component attached to the first one. Like that you can spawn as many as you like next to each other being the same object / blueprint while being multiple compontents.

Or do you simply need two cubes doing that? You could just place them inside of a simply actor blueprint in the space you want and they will be behave the same.

You could check out the video of procedural generated levels from epic. It might help you a little :slight_smile:

thx for the help :slight_smile: would the cubes that have been spawned together have the same physics? (like if they were glued)

Everything inside your blueprint (as long as it doesn’t spawn other actors) will be handled inside the level as one object. Everything you spawn inside of it will by default be added to the root and keep it’s relative position to it as long as this is not overridden by something else.

In your specific case this means you need one main object which is the root. You should decide if it should have physics or not here. All other objects (if spawned or added manually) will have to be attached to that root and mustn’t have “Simulate Physics” on. Otherwise it will override the relative position and act like a separate actor (even though it isn’t one).

ok, thx :slight_smile: could you just please tell me how the function is called to do like you describe? that would be awesome :wink: (yes I’m a newb… XD)

Which function? Spawning new mesh? Or what exactly?

To have two predefined objects stick together you simply need a blueprint with multiple actors.

Just search around the context menu.

There are node for most of the stuff you wanna do. In this case you could use the “Add static mesh component” inside of blueprints.

oh, is there a function to dynamically add the actors? I found the function attach actor to actor that i fire when i spawned the new cube, is there another/right/better way to do it?

Many thanks :slight_smile:

While testing that new technique I got a problem:
i push the origin cube, all goes well (exept it turne wiered as if the other cubes were not existant) and when i push another cube, nothing happends. I’d like to know how to solve that problem, so it behaves like if it would be a parallelepipedal mesh

maybe have a variable X, X is defined to be the location of the non-origin cube. then X becomes Y (updated X times/second), and if Y != X, you take the difference and move the origin cube accordinly?