In this course, you’ll create a sandbox-style game in Unreal Engine in which the player can build their own world with blocks of their own design. Along the way, you’ll learn about object-oriented programming using Inheritance, as well as many other important programming concepts.
After finishing this course, you’ll have a complete game framework and a platform on which to customize and build a game you design.
The first video in the tutorial shows that the SK_BlockCharacter has a Block attached to its right thumb. In the project I downloaded from the Epic Launcher, the SK_BlockCharacter does not have that Block…
I’m the instructor from the course. As @Whzak noticed above, the Character does not have the block attached - that happens in a later lesson.
The SK_BlockCharacter in the Unreal Learning Kit is also missing the socket that is demonstrated in the video.
There are two fixes for that:
Fix 1. Ignore the BlockSocket and when it comes time to attach the PreviewBlock component, search for “thumb_03_r” in the Parent Socket rather than the (missing) BlockSocket.
…or…
Fix 2. Add the BlockSocket to the SK_BlockCharacter by editing the SK_BlockCharacter, go to the Skeleton Tree tab, locate thumb_03_r, right-click, select “Add Socket” from the menu, name the socket “BlockSocket”, save, then close the SK_BlockCharacter.
Also, please note: The method of adding blocks using a blueprint and static mesh for each block can be very memory intensive if you add thousands of blocks. There are better ways to achieve a “block style game”, such as using instanced static meshes (ISMs). The educational goal of this course was to introduce an object-oriented hierarchy and give people a way to create custom blocks of their own design without having an overly complicated system for dealing with the visual aspect of the blocks.
I sincerely hope you enjoy the course and find it valuable! Please let me know if you have any questions.
Thank you for the tutorial.
I have a question about the SetTimerByEvent logic before either placing or removing the block.
What is the logic for this? Can we not just connect the logics after the custom events directly to the input actions?
The method demonstrated in the tutorial repeats the action while the RemoveBlock action is occurring (i.e. the mouse button is held down) by setting a timer that loops every .2 seconds. The timer repeatedly calls the RemoveBlockFromWorld custom event. When the RemoveBlock action key is released, the timer is cleared. The idea is that the action repeats while the mouse button is held down.
EDIT: The information below is not correct - the code below will result in blocks being removed even when the mouse button is released.
You are correct that this could also be accomplished using a delay at the end of the nodes and looping back around to the beginning. The issue I see is the logic using this method is a little more convoluted; you have to account for the False conditions in the Branch nodes to keep looping if the cursor isn’t on a block, or a breakable block. Here is how it would look:
There is one little issue in the Placing Blocks tutorial which can be improved.
That is, when the character turns to the clicked direction, it may turns from the opposite side with a larger rotation angle rather than from the side with a smaller one.
This is happened when one of the rotation yaw returned by the “Get Actor Rotation” and “Find Lookat Roation” function is less than 0, and the absolute value of difference of the two rotation yaw is larger than 180 degrees.
So it’s better to increase the rotation yaw by 360 degrees if the CurrentRotation or TargetRotation variable is minus in this case.
Below is the solution I made for your reference.
This may have not been in the video (I’ll have to go back and look), but I believe using the “Shortest Path” setting on the Lerp (Rotator) node in the timeline accomplishes this as well. Here is the code I have in my project:
EDIT: Just looked at the video, the “Shortest Path” check box is NOT checked in the RotateTimeline - it should be. As you noticed, it still works, but the character might rotate the long way around in certain circumstances. Thank you again for posting your solution!
Another strange problem, when I press the WASD keys, the charactor does not move straight toward that direction, but moves a little to the left side every second.
And after I switch to the first person view, all the WASD keys will make the movement toward left back side to the camera direction.
Yes, it is the collison of the preview block causes the problem.
I just disable the whole preview block child actor collision, after that the character can walk straightly, and WASD keys also work correctlly in the first person view.
Thanks a lot for you help!