Pong in C++ – The Paddle and The Wall

I am continuing the development of Pong in C++.

Unreal Engine 4.10

I have upgraded the project to Unreal Engine 4.10 without any difficulty. I am now using Visual Studio 2015.

HacknPlan

I am now using HacknPlan to manage the project instead of Trello.

The Paddle

I have created a new Pawn class named Paddle. I’ve added a UStaticMeshComponent to specify the mesh for my paddle.

I have set the mesh to simulate physics, disabled gravity and set a linear damping of 10. I’ve also locked rotation and translation for Y and Z:

 PaddleMesh->SetSimulatePhysics(true);
 PaddleMesh->SetEnableGravity(false);
 PaddleMesh->SetLinearDamping(10.f);
 PaddleMesh->BodyInstance.bLockXRotation = true;
 PaddleMesh->BodyInstance.bLockYRotation = true;
 PaddleMesh->BodyInstance.bLockZRotation = true;
 PaddleMesh->BodyInstance.bLockYTranslation = true;
 PaddleMesh->BodyInstance.bLockZTranslation = true;

 

I have also created a function MoveUp() to manage the movement of my paddle. It is a simple AddForce to the mesh on the X axis. I have created a Blueprintable variable name ForceRate to calculate the force to add to the paddle.

The Wall

I had to create a new static mesh for the wall replacing the previous boundary one. The height of the previous one was too short. I needed one with a height of 100 like the paddle. By just adding collision to it, it can block the paddle.

I have just added two walls to the levels.

Walls

About

Gamer

Tagged with:

Leave a Reply