Skip to content

Instantly share code, notes, and snippets.

View embiem's full-sized avatar

Martin Beierling-Mutz embiem

View GitHub Profile
@embiem
embiem / TagInput.css
Created April 20, 2017 13:50
TagInput-Component for React
.tags-input {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-content: flex-start;
justify-content: center;
}
.tags-input .tag-entry {
user-select: none;
cursor: pointer;
@embiem
embiem / cartpole_qlearner.py
Created February 9, 2017 11:14
OpenAI Gym Q-Learner for the cartpole environment
'''
Very basic Q-Learner that is tailored for the cart-pole environment.
This implementation leaves a lot of space for improvements.
'''
import gym
from gym import wrappers
import math
bool GetSightRayHitLocation(FVector& HitLocation) const
{
// Find crosshair position in pixel coordinates
int32 ViewportSizeX, ViewportSizeY;
GetViewportSize(ViewportSizeX, ViewportSizeY);
FVector2D ScreenLocation = FVector2D(ViewportSizeX * CrossHairXLocation, ViewportSizeY * CrossHairYLocation);
// "De-project" the screen position of the crosshair to a world direction
FVector LookDirection, LookStartLocation;
@embiem
embiem / UE4 Get Look Direction
Created June 24, 2016 07:24
A function to get the look rotation by supplying it with a screen location (e.g. half the viewportSize, to use the middle of the screen). Useful for crosshairs
bool GetLookDirection(FVector2D ScreenLocation, FVector& LookDirection) const
{
FVector CameraWorldLocation;
return DeprojectScreenPositionToWorld(
ScreenLocation.X,
ScreenLocation.Y,
CameraWorldLocation,
LookDirection
);
}