Skip to content

Instantly share code, notes, and snippets.

Brandon Austin Tarwine

View GitHub Profile
@Tarwine
Tarwine / MemoryManager.cpp
Last active May 26, 2017
Experimenting with custom memory management
View MemoryManager.cpp
#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];
@Tarwine
Tarwine / TacopocalypsePawn-CalcRotationDiff.cpp
Created May 26, 2017
Unreal 4 snippet which calculates difference in rotation over time for stunt detection.
View TacopocalypsePawn-CalcRotationDiff.cpp
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;
@Tarwine
Tarwine / MusicPlayerComponent.cpp
Created May 26, 2017
Unreal 4 script which handles music playback by adding functionality to UAudioComponent as a child class
View MusicPlayerComponent.cpp
#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()
@Tarwine
Tarwine / WallRunCharacter.cpp
Last active Dec 19, 2017
Unreal 4 wall running character source script
View WallRunCharacter.cpp
/**
WallRunCharacter.cpp
Primary player controls for wall running
@author Brandon Austin
@version 0.3 05/24/17
*/
#include "WallRun.h"
#include "WallRunCharacter.h"
@Tarwine
Tarwine / SplineCharacter.cpp
Created May 30, 2018
Unreal 4 spline movement script
View SplineCharacter.cpp
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);
@Tarwine
Tarwine / ShoulderAnchorManager.cs
Last active May 30, 2018
Unity ARKit estimate neck and shoulder position from head tracked location
View ShoulderAnchorManager.cs
//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]
@Tarwine
Tarwine / SurveyorWheelComponent.cpp
Last active May 30, 2018
Unreal 4 surveyor wheel which calculates procedural run cycle keyframe based on distance travelled
View SurveyorWheelComponent.cpp
#include "SurveyorWheelComponent.h"
#include "GameFramework/Actor.h"
USurveyorWheelComponent::USurveyorWheelComponent()
{
PrimaryComponentTick.bCanEverTick = true;
WheelRadius = GetWheelRadius();
}
You can’t perform that action at this time.