// PlayerCharacter.cpp · MartinWorks
#include "PlayerCharacter.h"
#include "GameFramework/CharacterMovementComponent.h"
void APlayerCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
const FVector Input = ConsumeMovementVector();
if (!Input.IsNearlyZero())
{
const float Speed = bSprinting ? RunSpeed : WalkSpeed;
AddMovementInput(Input.GetSafeNormal(), Speed);
FaceMovementDirection(Input, DeltaTime);
}
Stamina = FMath::Clamp(Stamina + Regen * DeltaTime, 0.f, MaxStamina);
if (Health <= 0.f && !bDead) { HandleDeath(); }
}
bool AEnemyAI::CanSee(const AActor* Target) const
{
FHitResult Hit;
const FVector Eyes = GetPawnViewLocation();
GetWorld()->LineTraceSingleByChannel(
Hit, Eyes, Target->GetActorLocation(), ECC_Visibility);
return Hit.GetActor() == Target;
}
Service · 02
Game-ready assets built to run.
Clean topology, correct scale, and engine-ready files you can drop straight into Unreal, plus playable prototypes when you need to prove an idea.