Skip to content

Instantly share code, notes, and snippets.

View braustin20's full-sized avatar

Brandon Austin braustin20

View GitHub Profile
@braustin20
braustin20 / SurveyorWheelComponent.cpp
Last active October 8, 2019 21:51
Unreal 4 surveyor wheel which calculates procedural run cycle keyframe based on distance travelled
#include "SurveyorWheelComponent.h"
#include "GameFramework/Actor.h"
USurveyorWheelComponent::USurveyorWheelComponent()
{
PrimaryComponentTick.bCanEverTick = true;
WheelRadius = GetWheelRadius();
}
@braustin20
braustin20 / ShoulderAnchorManager.cs
Last active May 30, 2018 17:57
Unity ARKit estimate neck and shoulder position from head tracked location
//Dynamically calculated head size values upon arkit face added event
//Estimated head height used to determine head's pivot
[System.NonSerialized]
public float headHeight = 0.0547f;
//Estimated head depth used to determine head's pivot
[System.NonSerialized]
public float headDepth = 0.0505f;
public float headWidth = 0.0447f;
//Shoulder width should equal ~ 2x head height
[System.NonSerialized]
@braustin20
braustin20 / SplineCharacter.cpp
Created May 30, 2018 17:25
Unreal 4 spline movement script
void ASplineCharacter::MoveRight(float Value)
{
if (GameStateRef == nullptr || GameStateRef->MovementSpline == nullptr)
{
AddMovementInput(FVector(0.f, -1.f, 0.f), Value);
return;
}
//Orient and move player in the direction of the spline
SplineDirection = GameStateRef->MovementSpline->Spline->FindDirectionClosestToWorldLocation(GetActorLocation(), ESplineCoordinateSpace::World);
@braustin20
braustin20 / MusicPlayerComponent.cpp
Created May 26, 2017 23:20
Unreal 4 script which handles music playback by adding functionality to UAudioComponent as a child class
#include "Tacopocalypse.h"
#include "MusicTrackData.h"
#include "TacoSingleton.h"
#include "Engine.h"
#include "SoundDefinitions.h"
#include "MusicPlayerComponent.h"
// Sets default values for this component's properties
UMusicPlayerComponent::UMusicPlayerComponent()
@braustin20
braustin20 / TacopocalypsePawn-CalcRotationDiff.cpp
Created May 26, 2017 23:05
Unreal 4 snippet which calculates difference in rotation over time for stunt detection.
FVector ATacopocalypsePawn::CalcQuatDifference()
{
//Get the current rotation in quaternion
FQuat CurrentQuat = GetTransform().GetRotation();
//Get the quaternion rotational difference
FQuat TempQuat = PrevQuat.Inverse() * CurrentQuat;
//Update the previous rotation value
PrevQuat = CurrentQuat;
@braustin20
braustin20 / MemoryManager.cpp
Last active May 26, 2017 22:55
Experimenting with custom memory management
#include "MemoryManager.h"
namespace MemoryManager
{
//Helper functions to help determine allocation sizes
int convertSize(int x);
int calcSize(int right, int left);
const int MM_POOL_SIZE = 65536;
char MM_pool[MM_POOL_SIZE];
@braustin20
braustin20 / WallRunCharacter.cpp
Last active September 11, 2023 09:19
Unreal 4 wall running character source script
/**
WallRunCharacter.cpp
Primary player controls for wall running
@author Brandon Austin
@version 0.3 05/24/17
*/
#include "WallRun.h"
#include "WallRunCharacter.h"