It's been a good couple of weeks since I last posted a blog entry. With the help of @Rutin and his 3D model making expertise, i've now implemented the hydraulic press mechanics within the game, and also finished the appearance of the laser tripwires. These were required to implement level 12 of Mr Boom's Firework Factory, the first level to use electricity mechanics.
The Completed Laser Tripwire
Starting with the laser tripwires, i selected some free to use models, and some cheap paid models and kitbashed them to end up with something visually appealing, with some help from @Rutin converting 3D studio files into FBX. Using a CCTV camera model, an SLR camera tripod, and some weird electrical gadget, this was the end result, connecting the set using a UE4 Cable Component:
There are two arrow components in this model, the one in the lens of the camera dictates where the laser beam originates from, and in which direction, and the one on the control box is a connection point for the cable actor which connects it to the object it powers. With this complete, i could move on to the hydraulic press itself.
Hydraulic Press Development
For the actual hydraulic press that connects to this laser tripwire, I'd started out with a basic primitive prototype, made of some textured boxes which i sent to @Rutin for a sense of scale so he could get started on something better:
I then left @Rutin to do his thing, and after lots of to-ing and fro-ing, talking about how it needed to look, he finally came back with the finished product, which i turned into an actor within the game proper...
The Hydraulic Press - The final model
I also decided to add some extra parts to the model to allow for connection to a cable (the pylon at the top of the model) and to allow for animation of the display screen. The display screen uses a simple texture atlas to animate its text when it is powered up:
The end result looks like this, and has some emissive applied to make it look more like an oldschool green phospor screen. It only appears when the machine is powered on:
Hydraulic Press Blueprint Events
This needed to be connected to the existing power system by deriving the class from my "Powered Object" class, which implements the base interface, and a set of related events added, one for powering it up and one for powering it down, plus a timer to animate the model.
Power on event
The power on event is called when the device receives power, it changes the materials of the screen and power button to 'lit' ones with texture atlases and emissives.
Power off event
The power off event reverses the behaviour of the power on event, reverting the glowing textures and texture atlases back to plain boring non-animated and non-emissive ones.
The animation event is powered by two timelines, one to quickly descend the crusher to the ground, detecting any collisions with crates as it sweeps and registers collisions. Any crates it collides with are set to explode as soon as possible.
The second timeline runs eight times slower, and ascends the crusher back to maximum height. Each of these timelines has a sound attached after it has finished executing, one for a loud slamming sound, and one for a hissing of hydraulics and steam engines.
Both of these events only operate while the object is powered, and if power is removed, the animation always completes, leaving the crusher part at its highest position allowing crates to pass through.
Once these are all rigged up, the whole thing can be tied together, which produces some wonderful and destructive machines:
The videos below show the hydraulic press in all its glory. Note that the first video does not show the camera shake effect, as I had de-posessed the player pawn to reposition the camera in a better position. It appears that in UE4, a de-posessed free floating camera does not receive camera shakes.
The view from the other side of the machine better demonstrates the camera shake effects used to add polish to the machine:
As always, feedback is more than welcome! Please feel free to comment below, and let me know if i missed anything! 🙂