本文整理汇总了C++中GetCharacterMovement函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCharacterMovement函数的具体用法?C++ GetCharacterMovement怎么用?C++ GetCharacterMovement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCharacterMovement函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetCharacterMovement
void ARoguelikeChar::ChangeStamina(float Amount)
{
CurrentStamina += Amount;
if (bIsOnCooldown)
{
if (CurrentStamina > CooldownResetLim)
{
bIsOnCooldown = false;
}
}
if (CurrentStamina <= 0)
{
CurrentStamina = 0;
bIsSprinting = false;
PlayerAnimationInstance->bIsSprinting = bIsSprinting;
StaminaRate = StaminaRate * (-0.5f);
GetCharacterMovement()->MaxWalkSpeed = InitialMovementSpeed;
bIsOnCooldown = true;
}
else if (CurrentStamina > MaxStamina)
{
CurrentStamina = MaxStamina;
}
PlayerController->UpdateUI();
}
开发者ID:DigitalDok,项目名称:MyPortfolioSnippets,代码行数:31,代码来源:RoguelikeChar.cpp
示例2: MoveForward
void AFPSCharacter::MoveForward(float Value)
{
if ( (Controller != NULL) && (Value != 0.0f) )
{
// find out which way is forward
FRotator Rotation = Controller->GetControlRotation();
// Limit pitch when walking or falling
if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling() )
{
Rotation.Pitch = 0.0f;
}
// add movement in that direction
const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
AddMovementInput(Direction, Value);
}
}
开发者ID:jhallard,项目名称:FPSProject,代码行数:16,代码来源:FPSCharacter.cpp
示例3: GetCharacterMovement
void AMech_RPGCharacter::BeginPlay() {
Super::BeginPlay();
GetCharacterMovement()->SetAvoidanceEnabled(true);
if (IsPendingKill()) {
return;
}
if (!UseLoadout) {
//CreatePresetRole(StartingRole());
}
else {
SetupWithLoadout();
}
if (abilities.Num() > 0) {
SetCurrentAbility(abilities[0]);
}
//SetUpGroup();
SetUpWidgets();
if (OnPostBeginPlay.IsBound()) {
OnPostBeginPlay.Broadcast(this);
}
}
开发者ID:belven,项目名称:Mech_RPG,代码行数:25,代码来源:Mech_RPGCharacter.cpp
示例4: GetCharacterMovement
void ARadeCharacter::DoubleJump_Implementation()
{
// Set player Velocity on server
GetCharacterMovement()->Velocity.Z += JumpJetPack.CurrentChargePercent*JumpJetPack.PushPower;
JumpJetPack.CurrentChargePercent = 0;
bCanFillJetPack = false;
}
开发者ID:dcyoung,项目名称:Rade,代码行数:7,代码来源:RadeCharacter.cpp
示例5: ToggleLaserVisibility
void ARoguelikeChar::InitializeGameplayStats()
{
BulletsLeft_A = (User_BulletsLeft_A > 0) ? MaxAmmoHolderSize : 0;
BulletsLeft_B = (User_BulletsLeft_B > 0) ? MaxAmmoHolderSize : 0;
BulletsLeft_C = (User_BulletsLeft_C > 0) ? MaxAmmoHolderSize : 0;
BulletsLeft_A_Total = User_BulletsLeft_A;
BulletsLeft_B_Total = User_BulletsLeft_B;
BulletsLeft_C_Total = User_BulletsLeft_C;
MaxStamina = 100.0f;
CurrentStamina = MaxStamina;
MaxHealth = 100.0f;
CurrentHealth = MaxHealth;
Kills = 0;
Wave = 1;
PlayerAnimationInstance->bCanShoot = true;
DeathCamera->Deactivate();
ToggleLaserVisibility(false);
InitialMovementSpeed = GetCharacterMovement()->MaxWalkSpeed;
bIsAiming = bIsSprinting = false;
PlayerController->UpdateUI();
}
开发者ID:DigitalDok,项目名称:MyPortfolioSnippets,代码行数:30,代码来源:RoguelikeChar.cpp
示例6: GetCharacterMovement
/**
* Update the default max speed rate with new rate.
*
* @param Speed to move
* @return void
**/
void APlayerCharacter::SetSpeed(float speed)
{
if(!SpeedBoostActive)
{
GetCharacterMovement()->MaxWalkSpeed = speed;
}
}
开发者ID:jackdurnford,项目名称:MidnightSnag,代码行数:13,代码来源:PlayerCharacter.cpp
示例7: GetCharacterMovement
FVector ACharacter::GetNavAgentLocation() const
{
FVector AgentLocation = FNavigationSystem::InvalidLocation;
if (GetCharacterMovement() != nullptr)
{
AgentLocation = GetCharacterMovement()->GetActorFeetLocation();
}
if (FNavigationSystem::IsValidLocation(AgentLocation) == false && CapsuleComponent != nullptr)
{
AgentLocation = GetActorLocation() - FVector(0, 0, CapsuleComponent->GetScaledCapsuleHalfHeight());
}
return AgentLocation;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:16,代码来源:Character.cpp
示例8: GetCharacterMovement
void APaperCharacter::PostInitializeComponents()
{
Super::PostInitializeComponents();
if (!IsPendingKill())
{
if (Sprite)
{
// force animation tick after movement component updates
if (Sprite->PrimaryComponentTick.bCanEverTick && GetCharacterMovement())
{
Sprite->PrimaryComponentTick.AddPrerequisite(GetCharacterMovement(), GetCharacterMovement()->PrimaryComponentTick);
}
}
}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:16,代码来源:PaperCharacter.cpp
示例9: GetCapsuleComponent
ABatteryCollectorCharacter::ABatteryCollectorCharacter()
{
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
// set our turn rates for input
BaseTurnRate = 45.f;
BaseLookUpRate = 45.f;
// Don't rotate when the controller rotates. Let that just affect the camera.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
// Configure character movement
GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...
GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate
GetCharacterMovement()->JumpZVelocity = 600.f;
GetCharacterMovement()->AirControl = 0.2f;
// Create a camera boom (pulls in towards the player if there is a collision)
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->AttachTo(RootComponent);
CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character
CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller
// Create a follow camera
FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
FollowCamera->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
FollowCamera->bUsePawnControlRotation = false; // Camera does not rotate relative to arm
// Collection Sphere
CollectionSphere = CreateDefaultSubobject<USphereComponent>(TEXT("CollectionSphere"));
CollectionSphere->AttachTo(RootComponent);
CollectionSphere->SetSphereRadius(200);
// Set Power Level
InitialPower = 2000;
CharacterPower = InitialPower;
// Set speed
SpeedFactor = 0.75f;
BaseSpeed = 10;
// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
// are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++)
}
开发者ID:DrunkReaperMatt,项目名称:BatteryCollector,代码行数:47,代码来源:BatteryCollectorCharacter.cpp
示例10: GetCharacterMovement
// Update power level of the character
void ABatteryCollectorCharacter::UpdatePower(float PowerChange)
{
CharacterPower += PowerChange;
// change speed based on power
GetCharacterMovement()->MaxWalkSpeed = BaseSpeed + SpeedFactor * CharacterPower;
// call visual effect
PowerChangeEffect();
}
开发者ID:digitaldominus,项目名称:BatteryCollector,代码行数:9,代码来源:BatteryCollectorCharacter.cpp
示例11: GetCharacterMovement
// Called when the game starts or when spawned
void ABaseCharacter::BeginPlay()
{
Super::BeginPlay();
OriginalWalkSpeed = GetCharacterMovement()->MaxWalkSpeed;
SetCameraView(bIsInFirstPersonView);
}
开发者ID:TheComet93,项目名称:iceweasel,代码行数:9,代码来源:BaseCharacter.cpp
示例12: FConstructorStatics
// Sets default values
ASoldierPawn::ASoldierPawn()
{
struct FConstructorStatics
{
ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> RunAnimationAsset;
ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook> IdleAnimationAsset;
FConstructorStatics()
: RunAnimationAsset(TEXT("/Game/2dSideScroller/Animation/Soldier/Run.Run")),
IdleAnimationAsset(TEXT("/Game/2dSideScroller/Animation/Soldier/Idle.Idle"))
{
}
};
static FConstructorStatics ConstructorStatics;
RunAnimation = ConstructorStatics.RunAnimationAsset.Get();
IdleAnimation = ConstructorStatics.IdleAnimationAsset.Get();
GetSprite()->SetFlipbook(IdleAnimation);
GetSprite()->SetRelativeScale3D(FVector(4.5, 1, 4.5));
// Use only Yaw from the controller and ignore the rest of the rotation.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = true;
bUseControllerRotationRoll = false;
// Set the size of our collision capsule.
GetCapsuleComponent()->SetCapsuleHalfHeight(90);
GetCapsuleComponent()->SetCapsuleRadius(43);
GetCapsuleComponent()->SetRelativeLocation(FVector(-25, 0, 0));
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
// PrimaryActorTick.bCanEverTick = true;
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root Component"));
// Configure character movement
GetCharacterMovement()->GravityScale = 2.0f;
GetCharacterMovement()->AirControl = 0.80f;
GetCharacterMovement()->JumpZVelocity = 1000.f;
GetCharacterMovement()->GroundFriction = 3.0f;
GetCharacterMovement()->MaxWalkSpeed = 600.0f;
GetCharacterMovement()->MaxFlySpeed = 600.0f;
// Lock character motion onto the XZ plane, so the character can't move in or out of the screen
GetCharacterMovement()->bConstrainToPlane = true;
GetCharacterMovement()->SetPlaneConstraintNormal(FVector(0, -1, 0));
GetCharacterMovement()->bUseFlatBaseForFloorChecks = true;
}
开发者ID:NightWolf007,项目名称:ContraProject,代码行数:52,代码来源:SoldierPawn.cpp
示例13:
void ACloud10Character::Jump()
{
JumpKeyHoldTime = 0.0f;
if (GetCharacterMovement()->IsMovingOnGround())
bPressedJump = true;
else bPressedJump = false;
}
开发者ID:KaroA,项目名称:Cloud-10,代码行数:8,代码来源:Cloud10Character.cpp
示例14: Tick
// Called every frame
void APlayerCharacter::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
if (_jumpCount > 0 && GetCharacterMovement()->IsMovingOnGround())
{
_jumpCount = 0;
}
}
开发者ID:Zyrst,项目名称:Run,代码行数:9,代码来源:PlayerCharacter.cpp
示例15: GetCharacterMovement
bool ANimModCharacter::IsCrouched() const
{
UCharacterMovementComponent* MoveComp = GetCharacterMovement();
if (MoveComp)
return MoveComp->IsCrouching();
return bIsCrouched;
}
开发者ID:Nimgoble,项目名称:NimMod,代码行数:8,代码来源:NimModCharacter.cpp
示例16: ClientSetIfAcceptMoveInput
void ATotemCharacter::EnterDeath()
{
ClientSetIfAcceptMoveInput(false);
bCanBasicAttack = false;
bCanUseAbility = false;
bAcceptCameraChange = false;
GetCharacterMovement()->Velocity = FVector(0.0f);
}
开发者ID:whiteeat,项目名称:TotemCodeSample,代码行数:8,代码来源:TotemCharacter.cpp
示例17: Super
// Sets default values
APlayerCharacter::APlayerCharacter(const class FObjectInitializer& PCIP) : Super(), Utils(Utilities(this)) {
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
CreateComponentFromTemplate(NewObject<UInventoryComponent>());
GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
selectedQuickSlot = Primary;
}
开发者ID:TriFuse-Infrared,项目名称:Oncoming-Pre-Alpha,代码行数:9,代码来源:PlayerCharacter.cpp
示例18: CharacterJump
void AMainCharacter::CharacterJump()
{
if (GetCharacterMovement()->IsMovingOnGround())
{
PlayCharacterSound(JumpSound);
}
AMainCharacter::Jump();
}
开发者ID:rcktscnc,项目名称:unreal-project,代码行数:8,代码来源:MainCharacter.cpp
示例19: GetCharacterMovement
/**
* Function to update character power
* @param _powerChange amount to change power
*/
void ABatteryCollectorCharacter::UpdatePower(float _powerChange)
{
_characterPower += _powerChange;
GetCharacterMovement() -> MaxWalkSpeed = (_baseSpeed + _speedFactor * _characterPower);
// Visual effect
PowerChangeEffect();
}
开发者ID:benji011,项目名称:Battery-Collector,代码行数:12,代码来源:BatteryCollectorCharacter.cpp
示例20: Super
AWeaponEssentialsCharacter::AWeaponEssentialsCharacter(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
CurrentWeapon = NULL;
Inventory.SetNum(3, false);
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
// Set our turn rates for input
BaseTurnRate = 45.f;
BaseLookUpRate = 45.f;
// Don't rotate when the controller rotates. Let that just affect the camera.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
CollisionComp = ObjectInitializer.CreateDefaultSubobject<UBoxComponent>(this, "CollisionComp");
CollisionComp->AttachParent = GetRootComponent();
CollisionComp->OnComponentBeginOverlap.AddDynamic(this, &AWeaponEssentialsCharacter::OnCollision);
// Configure character movement
GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...
GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate
GetCharacterMovement()->JumpZVelocity = 600.f;
GetCharacterMovement()->AirControl = 0.2f;
// Create a camera boom (pulls in towards the player if there is a collision)
CameraBoom = ObjectInitializer.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom"));
CameraBoom->AttachParent = GetRootComponent();
CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character
CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller
// Create a follow camera
FollowCamera = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FollowCamera"));
FollowCamera->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
FollowCamera->bUsePawnControlRotation = false; // Camera does not rotate relative to arm
/* Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
* are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++) */
}
开发者ID:CHADALAK1,项目名称:WeaponEssentials4.6,代码行数:45,代码来源:WeaponEssentialsCharacter.cpp
注:本文中的GetCharacterMovement函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论