在碰撞组件的OnComponentBeginOverlap事件中,使用Cast To BP_Character节点确认其他物件是角色蓝图的实例。 调用角色的IncreaseHealth函数,并传递一个值(例如,HealthAmount变量)。 Event OnComponentBeginOverlap (Other Actor) Cast To BP_Character (Other Actor) Is Valid? Call Function (BP_Character.IncreaseHealth)...
OnComponentBeginOverlap:在Collision添加开始接触碰撞体则启动,OtherActor接触对象必须是角色控制器 CastToBP_ThirdPersonCharacter:将当前Actor转换成角色控制器 LaunchCharacter:发射角色(方向向量*速度即速率) GetForwardVector:获得目标对象的向前的方向 1.18 Interact with the Dissolving Material 溶解材质交互 解析:创建静...
#include "CoreMinimal.h" #include "Character/CharacterBase.h" #include "Interaction/EnemyInterface.h" #include "Enemy.generated.h" /** * */ UCLASS() class AURA_API AEnemy : public ACharacterBase, public IEnemyInterface { GENERATED_BODY() public: virtual void HighlightActor() override; //...
AHeroCharacter::AHeroCharacter() { GetCharacterMovement()->bOrientRotationToMovement = true; //设置为true,角色将朝移动的方向旋转 GetCharacterMovement()->RotationRate = FRotator(0.f, 400.f, 0.f); //旋转速率 GetCharacterMovement()->bConstrainToPlane = true; //约束到平面 GetCharacterMovement(...
void ATdCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInputComponent(PlayerInputComponent); UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(PlayerInputComponent); Input->BindAction(IA_MoveForward, ETriggerEvent::Triggered, this, &ATdCharacter::...
void ATdCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInputComponent(PlayerInputComponent); UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(PlayerInputComponent); Input->BindAction(IA_MoveForward, ETriggerEvent::Triggered, this, &ATdCharacter::...
(NewAbilityCDO);1920//Set Input21BindAbilityToAction(NewAbilityCDO);22returnHandle;23}2425//为技能绑定按键事件26voidAAbilityCharacterBase::BindAbilityToAction(UAbilityOwned*AbilityCDO)27{28if(!AbilityCDO)29return;3031APlayerController* PlayerController = CastChecked<APlayerController>(GetController())...
voidAFPS_TestCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent); 如果项目设置中正确调整的话,这里的Component可以被Cast为UEnhancedInputComponent,然后调用BindAction即可。 四个参数对应为: UInputAction:想要相应的IA 触发条件:具体包含的条件自己看源码注释吧,解释起来比较麻烦 ...
BaseAssetName should be determined by a short and easily recognizable name related to the context of this group of assets. For example, if you had a character named Bob, all of Bob's assets would have the BaseAssetName of Bob.For unique and specific variations of assets, Variant is ...
} void AFirstPersonCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInputComponent(PlayerInputComponent); if (UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(PlayerInputComponent)) { // Bind the Move action to the Move ...