I want to make a football that I can apply impulse/force to it via a PlayerController, using the Blueprint system.
At first I setup a sphere StaticMeshActor in the scene, tweaked scale, mass, enabled simulate physics etc. And I converted it to a Blueprint class so that I can reuse it later.
I want to control the ball using keyboard or joystick, so I thought a Pawn is needed for the ball to receive input. So I created a Pawn and dragged the ball actor into the component tree, and replaced the root component with it.
There’re a two things to implement:
- receive input events, and compute the direction and strength of the impulse/force
- apply impulse/force
I prefer implementing 1 in PlayerController, and 2 in the Pawn.
I learned that I have to get the StaticMeshComponent of the ball in order to apply impulse/force to it.
The first question is, how do I do it in the pawn? As mentioned above, I have dragged the ball actor as the root component of the pawn, here I get an ActorComponent, how do I get the StaticMeshComponent of it?
The second question is, how to command the pawn to apply impulse/force in the PlayerController?
I’m new to Unreal, and am bewildered by the engine system, Please tell me if I’m doing right.
BTW, I a programmer and I played with Unity and Godot, I think they are easier to start with, especially Godot.