The reported fall-through was a misdiagnosis: the player never fell. The imported Terrain_DEM had only a bounding-box simple collision proxy, so a downward trace anywhere in the block hit the terrain at Z 819 (the mesh bbox max) and the street sat under an invisible 8 m lid. Standing on that box looked plausible, which is why it read as working. - add UGigLineAssetTools (C++): force CTF_UseComplexAsSimple on a static mesh. UE 5.8 dropped bUseComplexAsSimpleCollision and Python cannot set the flag; the builder also saves the asset, since the flag lives there and a map-only save silently reverts it. - spawn (-13336, -1150, 600): inside the carved corridor (the cut is a 10.7 m half-width around the road centreline), lands on the road at 456. - fix ResetToStart returning to the mid-air PlayerStart captured in BeginPlay: StartLocation is now captured on the first grounded frame. - HighResShot 1280x720 instead of "1280 720", which is a multiplier. - add -qaselftest: scripted walk/reset/pause on a core ticker plus a swept ground transect. Results: walk 746 cm/2 s with Z steady, reset 0 cm from spawn, pause/unpause 1/0, transect 84 samples 0 holes. - rebase onto main, keeping the frontage materials and placement fixes.
124 lines
4.1 KiB
C++
124 lines
4.1 KiB
C++
// First-person player character for the 0.1.0 walkable Hollywood block.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Character.h"
|
|
#include "InputActionValue.h"
|
|
#include "GigLineCharacter.generated.h"
|
|
|
|
class UCameraComponent;
|
|
class UInputAction;
|
|
class UInputMappingContext;
|
|
|
|
|
|
/**
|
|
* Walking first-person character.
|
|
*
|
|
* Movement is C++ and network-agnostic in the shapes it uses (Enhanced Input ->
|
|
* AddMovementInput), so a Blueprint subclass can retune values without touching
|
|
* code. Defaults are human-scale: 1.75 m capsule, 1.6 m eye height, 4 m/s walk.
|
|
*/
|
|
UCLASS()
|
|
class GIGLINE_API AGigLineCharacter : public ACharacter
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
AGigLineCharacter();
|
|
|
|
virtual void BeginPlay() override;
|
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
|
|
|
protected:
|
|
/** Loads the Enhanced Input assets from /Game/Input; called from BeginPlay. */
|
|
void LoadInputAssets();
|
|
|
|
/** Teleports back to the map's PlayerStart and clears velocity. */
|
|
void ResetToStart();
|
|
void TogglePause();
|
|
|
|
/**
|
|
* TEMP QA: scripted walk / reset / pause verification.
|
|
*
|
|
* Enabled only by the `-qaselftest` command-line switch, so it never runs in
|
|
* normal play. It exists because those three behaviours were listed as
|
|
* "needs a human at the keyboard" and a repeatable headless check beats
|
|
* waiting for one.
|
|
*/
|
|
void StartQASelfTest();
|
|
|
|
/** Set while the self-test is driving forward input. */
|
|
bool bQATestWalking = false;
|
|
|
|
/** Repeating timer that captures StartLocation on first ground contact. */
|
|
FTimerHandle SettleHandle;
|
|
|
|
/** Where the player started, so reset returns there rather than the origin. */
|
|
UPROPERTY()
|
|
FVector StartLocation = FVector::ZeroVector;
|
|
|
|
UPROPERTY()
|
|
FRotator StartRotation = FRotator::ZeroRotator;
|
|
|
|
bool bPaused = false;
|
|
|
|
/** Moves along the control yaw by the given forward/strafe amounts. */
|
|
void ApplyMove(float Forward, float Strafe);
|
|
|
|
/** Handles input actions to movement; assigned in C++ so the project runs with no assets. */
|
|
/** Forward/back and strafe are separate 1D actions, summed into one move. */
|
|
void MoveForward(const FInputActionValue& Value);
|
|
void MoveStrafe(const FInputActionValue& Value);
|
|
void MoveBack(const FInputActionValue& Value);
|
|
void MoveLeft(const FInputActionValue& Value);
|
|
void Look(const FInputActionValue& Value);
|
|
void StartJump();
|
|
void StopJump();
|
|
|
|
/** Mapping context for the gamepad and keyboard. */
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputMappingContext> MappingContext;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputAction> MoveAction;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputAction> MoveBackAction;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputAction> StrafeAction;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputAction> StrafeLeftAction;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputAction> LookAction;
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputAction> JumpAction;
|
|
|
|
/** Respawn at the start point (R). */
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputAction> ResetAction;
|
|
|
|
/** Toggle the pause menu (Escape). */
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Input")
|
|
TObjectPtr<UInputAction> PauseAction;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Camera")
|
|
TObjectPtr<UCameraComponent> FirstPersonCamera;
|
|
|
|
/** Degrees per second per unit of mouse input; defaults to Unreal's usual 45. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
|
|
float LookSensitivity = 45.0f;
|
|
|
|
/** Invert the pitch axis, for players who prefer it. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
|
|
bool bInvertLookY = false;
|
|
|
|
/** Walk speed in metres per second; converted to Unreal units on first use. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement")
|
|
float WalkSpeedMetresPerSecond = 4.0f;
|
|
};
|