1.动画蓝图 包含 状态机 包含 混合空间BlendSpace,即状态机包含在动画蓝图的"动画图表中",而混合空间可用于在状态机中向某(没)一个状态输出最终POSE:
动画蓝图一共包含两个东西,除了上面提到的动画图表,还包括了一个事件图表。动画图表中,状态机内肯定有一些变量来决定状态的转换,比如"isInAir","speed"等。而这些都可以在"事件图表"中得到并设置:
动画又是怎么和我们控制的角色关联起来的呢?
第一种方式是通过Character蓝图,然后如图有相关选项进行关联,下图的例子关联了动画和Mesh
2.新建的c++项目,是不包含Character类的, 但包含一个parent class 为 GameMode的类
关于出生点,最好是在GameMode类的基础上新建一个GameMode蓝图,然后在蓝图中设置Default Pawn Class:
然后还要在设置->世界设置中进行设置:
关于输入,这样的代码出现在Character类中:
void ABatteryCollectorCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
// Set up gameplay key bindings
check(InputComponent);
InputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
InputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);
InputComponent->BindAction("Collect", IE_Pressed, this, &ABatteryCollectorCharacter::CollectPickups); InputComponent->BindAxis("MoveForward", this, &ABatteryCollectorCharacter::MoveForward);
InputComponent->BindAxis("MoveRight", this, &ABatteryCollectorCharacter::MoveRight); // We have 2 versions of the rotation bindings to handle different kinds of devices differently
// "turn" handles devices that provide an absolute delta, such as a mouse.
// "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick
InputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
InputComponent->BindAxis("TurnRate", this, &ABatteryCollectorCharacter::TurnAtRate);
InputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
InputComponent->BindAxis("LookUpRate", this, &ABatteryCollectorCharacter::LookUpAtRate); // handle touch devices
InputComponent->BindTouch(IE_Pressed, this, &ABatteryCollectorCharacter::TouchStarted);
InputComponent->BindTouch(IE_Released, this, &ABatteryCollectorCharacter::TouchStopped);
}