# Learning UE4 Niagara

I’m working through some tutorials on how to use the video FX module in Unreal Engine. Here, I’ve outlined a static mesh of my favorite element with glowing embers and added a very rudimentary lens flare.

# 2D, 3D, let’s explore molecular geometry

It should go without saying that I am a fan of incorporating digital fabrication tools into chemistry instruction. A while back, Scott McIndoe and his colleagues published a paper in the Journal of Chemical Education on using laser cut models to teach molecular geometry. At first, it seems counter-intuitive to use a 2D design process to teach 3D topics. On top of that, if you have access to a laser cutter, you probably have access to a 3D printer, so why not just use the 3D printer?

3D printing is great for rapid prototyping; however, when you want to scale up production – say, for example, you want models for a classroom of 100 students – then 3D printing is not a great solution. Laser cutting is one of the fastest, easy-access digital fabrication tools available, and build times can be drastically reduced if a laser-cutter solution is available.

Then again, one needs access to a laser cutter. And that is something I (sadly) do not have at present.

So I took Scott’s design and adapted it to 3D printing. Yes, his paper provides some STLs to print, but if you want to create different sizes, then you have to do some scaling. I wanted a parametric approach, so I resorted to OpenSCAD to recreate his design. The code is below, in case you are interested.

Why would you want to use this? I don’t know, perhaps you want to make super thin molecules or super small molecules. All I know is, now you can.

/*
Origin: @mcindoe
Reference: https://pubs.acs.org/doi/10.1021/acs.jchemed.8b00553
*/

ca_d = 12; // diameter of central atom
ca_g = 5;  // length of the gap in the central atom
oa_d = 10; // diameter of the outer atom
bond_w = 5; // width of the bond
bond_l = 25; // length of the bond
th = 0.2+3*0.35; // piece thickness (my printer is set to 0.2 mm first layer and 0.35 subsequent layers)
allowance = 0.05; // adjust gap size for tighter/looser fit, YMMV
\$fn = 25; // Keeps round parts round

/*
n is the number of bonds (1, 2 or 3).  Setting tet to true will force a 109.5 degree bond angle.  NOTE: you shouldn't call this function, use makepiece
*/
module makebonds(n,tet=false) {
for(i =[1:n]) {
rot = tet?125.25+(i-1)*109.5:i*360/(n+1);
rotate(rot,[0,0,1])
translate([bond_l,0,0])
union(){
circle(d=oa_d);
translate([-bond_l,-bond_w/2,0])square([bond_l,bond_w]);
}
}
}

/*
n is the number of bonds (1-3).  Setting tet to true will force a 109.5 degree bond angle
*/
module makepiece(n,tet=false) {
rot = (tet && (n==1))?70.5:0;
linear_extrude(th)difference(){
union(){
circle(d=ca_d);
makebonds(n,tet);
}
rotate(rot,[0,0,1])translate([ca_d/2-ca_g,-(th+allowance)/2,0])square([ca_g,th+allowance]);
}
}

// Example usage
for(i=[ [-10,-20,0], [10,20,0] ]){
translate(i){
makepiece(3);
translate([40,0,0])makepiece(1);
translate([-40,0,0])makepiece(2);
}
}



# Final project of the summer

So I’ve wrapped up my final project of the summer. During the pandemic, I’ve been brushing up on my electronics and learning how to use the Unreal Engine to create video games. I wanted to see if I could tie those two ideas together. Watch the video below to see how it’s possible to create a video game that requires you to know what is going on in the physical world. In this case, the color of an LED connected to a microcontroller informs the gamer which colored sphere to shoot.

# UE4: Editor assist

I’m continuing to wrap up some summer projects before school starts. I’ve been learning how to create games in Unreal Engine over the past few weeks. One tool that I’ve found handy has been the ability to use Blueprints while in the editor to make life easier. This is one such example, where I use Blueprints to place an actor where the in-editor camera is located.

# Web-enabled games

Summer is almost over, and I am cranking through a bunch of projects I had wanted to complete. One of them was to spend as much time as possible learning how to make video games.

I don’t have any delusions of grandeur; however, I do have a fantasy of being able to combine game making with electronics and making in order to design a game that interacts with the physical world. In order to do that, I need a way for the game to communicate with the physical world.

In a previous post, I highlighted some of the things I learned during my first 100 hours with the Unreal Engine. That was enough time (with the right tutorials) to build a simple game called Chicken in the Lab where your a Chicken, in a lab, collecting elements. The trick is that you have to collect them in order of atomic number, so it can be a bit of a challenge.

With some general knowledge on game design using the Unreal Engine, I wanted to learn how a game could interact with the world outside of the game. There’s a plugin called VaREST which allows the game to communicate via REST API calls; however, the documentation on the plugin is virtually nonexistent. I decided to demonstrate how I got it working primarily to have all of this information in one place when I need it again, but perhaps it will be of use to someone.