DAY 38
So yesterday I talked about being almost done with the zipline. And I also mentioned that I needed to re-work the original zipline in order to suit the needs of the project, which are as follows:
A. Be unidirectional
B. Have a proper start and proper end
C. Clean and simple code
Starting from the ground up:
1) a spline mesh component was needed in order to pull this off.
2) to "dress up" the actual spline component so that the player can see the zipline, a cable component was added over the spline component.
3) adding 2 collision boxes and 2 zipline poles: one of each to the start pole and one of each to the end pole
4) attach cable component to the end pole
5) match each spline point to the start pole and the end pole and attach the spline points to the meshes
And so, a properly set-up, fully customizable zipline...in physical form, nothing functional except for the moving poles with the cable. This solved problem B
Now, things got slightly tricky here. Avoiding math (almost) completely, the following (oversimplified) recipe was used:
1) add 2 overlap triggers, one for each pole. One pole will trigger attaching to the zipline, the other the detaching.
2) When attached, pull information from the spline's current length (get it's length and then the location and distance along the spline)
3) Simply set the new actor location (it literally is a function)
4) When at the end pole, overlapping the end pole trigger, launch the character just low enough in the air (yes, you launch it with a negative value) to detach from the zipline.
And now, we have a working zipline. This solves both problem A and problem C. The final result looks something like this:
https://drive.google.com/file/d/1ss8pqhNRIEEaezkULBvLI8_0xRgjUZ9y/view?usp=shari...
See, guys? The simpler, the better. And with no math.
Please don't take this as a tutorial, it is most definitely not such a thing. It's an oversimplified high-level overview of a mechanic. Or a template, if you will. Hell, maybe this is how ziplines are actually done.
Oh, did I mention about the bugs? No? Well, let's begin:
How about being ziplined to the right instead of forward? That one was fun (took a long time to figure out, but once found, was a super easy fix...a matter of changing a drop-down menu item from Relative to World...can't remember which function tho)
How about the cable component stretching to the width of the pole? This one was just dumb, like how tf? Unreal engine was like "nah, imma give you a long sheet of plexiglass instead of a cable".
How about having the controller completely disabled after getting through the start trigger? That one was on me, I was suffering from the dumb. Had a disable function active on the end trigger, in the hopes that it will disable the designated key to use the zipline. Of course, it disabled the entire keyboard.
Kind of a minor inconvenience, but the character snaps to and from the zipline. This I don't like, I would want for it to be smooth, both in and out of the zipline mechanic, but that's a job for future me. The important thing is that it works just how I wanted.
That's about it for today, see ya in the next post, bye.