Skip to content

Instantly share code, notes, and snippets.

// Trace code for UE4. Make sure you set a custom Object Channel (not Trace Channel) in the project settings under Engine - Collision.
// Reboot UE4 to take effect if necessary.
// Create a custom collision preset with Object Type set to your new channel.
// In your code, the channel is referenced as ECC_GameTraceChannel[0-18]. Make #define to alias it.
// Check Config/DefaultEngine.ini. Comparing different values and tests helped me a lot.
// MSTJ.
#define MyObjectChannel ECC_GameTraceChannel1
FCollisionQueryParams TraceParams(FName(TEXT("CameraPanHit")), true, nullptr);
@marcthenarc
marcthenarc / dl.sh
Last active April 8, 2018 17:13
A youtube-dl script to download some video. Usage : ./dl.sh <yt tag>
#!/bin/bash
title=`youtube-dl --get-filename -o '%(title)s.%(ext)s' $1`
youtube-dl -o - $1 > "$title"
@marcthenarc
marcthenarc / gist:7763e5a6e08d15802e526d4ea86310e7
Created December 12, 2017 16:39
Search an array of binary characters (including NULL) andreturn the pointer to the first match.
char* binaryArraySearch(char *haystack, size_t sizeOfHaystack, const char *needle, size_t sizeOfNeeddle)
{
for (size_t i = 0; i < sizeOfHaystack; i++)
{
if (haystack[i] != *needle)
continue;
bool pass = true;
int keep = i;
@marcthenarc
marcthenarc / Perlin_Tiled.cs
Created September 8, 2017 12:18 — forked from Flafla2/Perlin_Tiled.cs
A slightly modified implementation of Ken Perlin's improved noise that allows for tiling the noise arbitrarily.
public class Perlin {
public int repeat;
public Perlin(int repeat = -1) {
this.repeat = repeat;
}
public double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;