The completed code: https://github.com/Nasser-GameDev/Ball_Project
Useful documentation page : https://docs.unrealengine.com/en-US/ProgrammingAndScripting/ClassCreation/CodeOnly/index.html
Note:
Although it is labeled part 2 part 1 was just the exact same interaction system but made in blueprints instead of C++. I ended up explaining everything from scratch so you don’t have to watch part 1 to understand this video.
Function prototype for interaction:
UFUNCTION()
void WhenTouching(class UPrimitiveComponent* OverlappedComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
Header files :
#include « Components/TimelineComponent.h »
#include « Components/StaticMeshComponent.h »
#include « Components/TimelineComponent.h »
#include « Components/SphereComponent.h »
#include « GameFramework/RotatingMovementComponent.h »
#include « Kismet/KismetSystemLibrary.h »
0:00 Intro/Creating Interaction Base
1:44 Diagram of how we will design our interaction system
3:11 removing unnecessary functions
3:58 Creating the necessary components for our interaction Base.
6:59 Explaining how interaction works in UE4
12:01 Implementing our interaction system
20:11 the logic we want for when an interaction occurs.
26:18 Including the header files
27:47 Forgot the dam semicolons.
28:44 Fixing spelling Errors
31:03 going Back to the editor after creating the interaction Base Class
31:46 Assigning meshes/materials for our interactionBase
32:42 Explaining what settings have changed because of our code
33:16 Another way of explaining the interaction system
35:00 Testing out the interaction system.
35:20 Making minor adjustments to our BallCharecter_CPP
37:53 Testing out the interaction system
38:09 Quick Summary of interaction Base code.
39:03 When is a cast successful and when is it a failure
42:48 Talking about what we finished and what we have left
44:06 Creating our Pick Up class.
45:30 Went off on a tangent.
48:27 The logic for how we get the coins attracted to the character
50:30 Making a coin attracted to your character in C++ part 1
1:00:05 thinking about what we have coded
1:00:34 including headers and fixing spelling
1:02:13 testing out What we have coded so far
1:04:43 Making a coin attracted to your character in C++ part 2
1:28:05 explaining the timeline Function Calls(important and complicated)
1:35:04 Lerp & update function
1:38:44 fixing compilation errors.
1:40:21 When should you reparent your blueprint class?
1:41:27 When should you just close the editor and open it again
1:42:39 Quick summary of what we did so far with the pick up code.
1:43:21 Testing our pick up code
1:44:08 correcting logic error.
1:47:36 Assigning meshes/materials for our PickUp
1:48:34 adding macro to TimelineUpdateFunction and testing it
1:49:22 Fixing a null error.
1:50:06 testing the pick up code for the last time.
1:50:25 Transition to the jump pad.
1:50:50 Creating the JumpPad class
1:58:56 Assigning meshes/materials for our JumpPad
2:00:07 testing the Jumpad Code
2:00:17 Creating the end Goal
2:05:19 Testing the end goal
2:06:13 outro
Source