Sunday, October 26, 2014

Push Mirror

So I took the pushable block and turned it into a mirror.  I think when I first posited this idea, I figured I'd be having the shaft of light spawn a second shaft when the mirror passed into it.  Simple enough, unless you need to make the mirrors turn around as well.  Instead, this mirror produces a shaft when it enters the light and puts it away when it leaves.  This way, the reflection can be redirected when the mirror turns.

Granted, there are issues when a pushable object is also turnable, but I assume that can be fixed or circumvented easily.  First, let's take a look at our mirror.


You may notice a couple of additions to the push sphere.  First is the box on top to act as a trigger volume to detect the light.  Actor Overlap wouldn't work with this for some reason.  Next, if you look carefully you may notice the cone hidden inside the sphere.  Using add component like with the shaft worked fine, but I couldn't figure out how to subtract it once it was there.  I could, however, use Destroy Component to get rid of the sphere itself.  Just so you know we can do that sort of thing.


Instead, we're using Set Static Mesh.  Now that I think about it, if the light isn't a static mesh this won't be very useful.  Hopefully, there's a counterpart for whatever we do end up using.  Anyway, Set Static Mesh changes the static mesh of the target object, and has a pull-down menu so you don't need some other widget to set that.  I set the target of the command by dragging the cone from Components list into the Target slot of the command.  OnComponentEndOverlap then triggers the command again with instructions to turn it back.

Let's see it in action:


The other doodad there is just to set off the overlap commands and doesn't have any actual commands of its own.

Next I tried making a destructible mesh, but I didn't think it warranted much explanation.  All you have to do is right-click on a static mesh in the content browser (I made a copy of one first, though I don't think it will be necessary) and select "Create Destructible Mesh."  It also opens a special editor window for it, and there's a tutorial there, too.  I tried testing it out, but I don't know how to cause damage with My Projectile yet.

Sunday, October 19, 2014

Pushable Object, Rotatable Object, "Reflecting Light"

Okay, I'm feeling a little behind here, but here are some things I made in Unreal 4 in the past couple of weeks.

Pushable Object


So our game is supposed to feature plants that the water gun can make grow and then act as platforms, jump pads, etc., but there is also a temple in the game. My big idea was that maybe there isn't enough light in the temple for the plant to grow, except under holes in the ceiling where light shines through.  Thing is, not all the plants are planted under shafts of light.  So how do you get the light to the plant?  With mirrors, of course!  Why are there mirrors in this temple?

...You ask too many questions, bub...

But just leaving the mirrors under the shafts of light would make things too easy!  It would be more fun (or at least time-consuming) if the players had to push the mirrors into the light.  Let's take a look at our mirror:
Okay, so it's not a mirror.  Sue me.  What matters are those boxes on either side.  At first I tried to use Blueprint to discern from what direction the player was approaching the object from, but I eventually gave up and just put boxes around the object.  Maybe that functionality exists in Unreal 4, but this should work for now.
This this is the Graph.  The thought occurs that there may be a more elegant solution than to use "Make Transform" and "Add Actor Local Transform," but it's getting kind a late and I only remember having issues with other commands (although that may have something to do with my trying to make the object both rotatable and pushable).  Anyway, you'll need one set of those for every box around the object so you can push it in any direction.  The Timeline component is to make sure the object doesn't just teleport to its destination.
 Double-click on the Timeline to open it's graph.  It'll put a little tab up there so you don't have to do that again.  Click "Add Vector Track" and it'll add a timeline here as well as a corresponding output on the component.  There'll be a red line at the bottom of the timeline, representing the X axis.  Shift+Click this to add Keyframes to the timeline, which has a "Time" variable and a "Value" variable (representing its location in this case).  You need two of these, one representing where the object is now (0 seconds and 0 distance away), and the other representing how far you want it to go and how fast.  The Value will be positive or negative depending on the direction.  There are also green and blue lines representing the Y and Z axises, respectively, for when you want the object going in those directions.  Click the eyes on the upper right of the timeline to make them visible or invisible.

Rotatable Object

Just pushing blocks too boring, you say?  How about if you had to rotate them, too!?  Well, I tried making it pushable and rotatable, but it just had a seizure when I tried to push it.  Then I put a component on it just for turning it, but turning it while it was moving made it change direction.  Might have to do with the "Local Transform" command.  I'll have to look into it.  Right now, I'm thinking it might be better to put a rotatable object on top of a separate, pushable object if you want to do both.  Might have to parent them or something.
Anywho...
 No boxes.  Doesn't really need it as long as it has collision already and you only want it to do one thing.  You'll notice that it's the same static mesh as the other object, which is why I put materials on them.
Pretty simple.  "Event Hit" allows it to trigger when hit by projectiles.  Unfortunately, it also triggers when hit by the player and I haven't figured out how to get it to differentiate between the two yet.  I tried using Timeline to make it turn gradually, but not only did it not work, but the first time I hit it caused it to continuously spin for a moment.  That's its first reaction whenever you start playing, but subsequent strikes generally responded normally.  It might be possible to get it to turn gradually, but I'll have to continue looking into it.


Reflectable Shaft of Light

I feel like I'm forgetting something... Oh, duh!  The shaft of light! Gotta reflect something, right?
Okay, it's actually a solid column.  It doesn't matter what I put in there, as long as there's a volume somewhere that will detect collisions.  This one just has a small one at the base.
You can find "OnComponentBeginOverlap" by right-clicking the component under "My Blueprints" and going to "Add Event."  The "Add Static Mesh" command is as easy as dragging the target asset into the Graph.  The Branch is there to make sure the shaft doesn't respond to the player touching it.  Make sure the Transform has the new component spawn at a different angle or location, or there'll just be two in the same place.

Want to see these Blueprints in action?  Of course you do!  TO YOUTUBE!

Using Kachujin in third person again.  I followed Marcus' "Third Person Shooter" instructions, and she looks even more gimpy.  The Mixamo characters have either shoot or throw animations, but I'll have to mess with shooting Blueprints to make it work right with them.

I'll keep you posted if I come up with more.








Monday, October 6, 2014

Stuff I Made This Week

Well, I didn't come up with any more puzzle ideas just yet, but I did manage to make a few things that might be helpful in the future.

First is a Teleporter.  Probably won't be used in this game, but they were the first things in my UDK notes and it was bothering me that they didn't come premade in Unreal 4.  They'll probably do that in a future update, but for now here is my blueprint.


My main problem was that I was pretty dense.  Teleport and Event Actor Begin Overlap weren't difficult to find, with the search function in the components list and all.  The steam is just a visual effect, but I couldn't get the overlap to work until I got that box in there.  Add Component > Shapes > Box.  I had thought it was just geometry when I first saw it, but after an aggravating tutorial search I discovered it was a bounding box or something.

Here's a video of it in action:
 
Oh, and I had installed the Mixamo character pack.  I happened to like this one, so I used her instead of the blue guy.

Next is the Jump Pad.  We'll probably be using this blueprint a lot.  Also annoying that they don't have a prefab of it yet.  I had to go to the Unreal 4 forums to find out how to do this, but the aggravation didn't start until I tried to find the components.  Sure, "Launch" seems obvious now, plus you can't find it in a search until you uncheck Context Sensitivity.  "Cast to Actor" was even worse.  It didn't show up in any search!  I had to find it manually.  Call Function > Utilities > Casting.  And you're going to need that, since "Actors" don't qualify as "Characters" for some reason, and it won't even compile without an input to the target.  It defaults to "Self," and while that may be cool for Teleporters it won't fly for Launchers. Pardon the pun.

 It didn't seem to work until I set the Z velocity to 1000.  I didn't really experiment with the numbers beyond adding zeroes to the end yet, so I don't know what the actual minimum is.  I can tell you, though, that there is no noticeable effect at 100.

You could say it looks like a marshmallow, but I think it kinda looks like a propane tank.  For the video below, I set it a bit into the ground so I could just walk onto it.  I also switched to the blue guy because the Mixamo characters just use their run animation in stead of their jump animation when they hit it.  It looked really weird, and I thought it might cause concerns if I used one of them for the video.


A week well spent, I must say.