HI I’D LIKE TO MAKE FRACTAL IN BLUEPRINT IMAGE BELOW
Sierpiński’s Triangle has been done in code too many times. It shouldn’t be difficult to replicate in BPs.
Use the name as a keyword when searching.
@Everynone you doing literally everything eh?
It’s been a while since I saw that name pop up :).
Can’t resist to show off… But honestly, I’ve learnt so many things trying to crack some of the cases I run into. Half of which teach me how not to approach certain issues.
At a glance it looks like the variables you’re using are declared outside of the function; make them local. In fact, the only non-local variable you’ll need here is the Triangle array.
All default to 0.
My result… not what I was counting for but close:)
I messed up maybe a variable x and y that is Yours? Because in blueprint is not set x and y. Thanks fro comment and resolution of this issue:)
.
Ok I redo it and everything works like a charm.Topic is resolved. So Thank You for Your time.
Glad to hear that. Good luck with the rest!
One more question. How did You do transfrom triangle to small triangle and alternately to big one.
You mean the animation? I run it on a timer and halved the reductor every .5s, like so:
Can be reversed, of course. The gif just loops.
note: do ensure you clamp min or it will lock the editor and your cpu will melt.
I remember looking at these 3D fractals in UE a while back. It’s amazing work, could make some really trippy levels with those
This was a fun little exercise:)
Here’s a solution with spawning an actor for each triangle, because why not (except for the many, many, obvious performance reasons)
Make a BP class called Triangle and put put this into it.
BeginPlay:
First thing done is getting triangle corners in local space (from the center, as if it was a unit triangle in 2D)
On tick:
Transform these into world space using this actors transform
Then draw a debug lines between them (set the duration to 0, 100 was for debugging for me)
To iterate to next level, press F (make sure that it’s not consuming input, otherwise only one will spawn)
- you see what happens there - 3 kids get spawned, each half-way to the local corner - the one missing link is the same as the two before, just with LocalTop
Copypasta of the attached text directly to BP should work if you’re on 4.24
Then just place a Triangle actor into the scene, scale it up, rotate it however you want and keep pressing F until your CPU dies
Works with any scaling/rotation and you can move them in-game too.
If you won’t need to move the triangle after initial placement, you can keep the long draw line time and kill the actor when you press F and it already has multiplied.
After a while, you will have a ridiculous amount of actors ticking, so if you feel like it, combine the principles from mine and Everyone’s answer and make an efficient, world-placeable BP
Here’s a vid on how to setup the BP super quickly
And the BP copypasta text:
[Blueprint source][1]
Now use Instanced Static Meshes to make these!
Which reminds, me:
Cool examples and a great read overall:
https://forums.unrealengine.com/community/work-in-progress/109261-fractals-in-ue4
And a great demo from the same person:
https://forums.unrealengine.com/community/work-in-progress/102191-explore-3d-fractals-with-a-dragon