Skip to content

Instantly share code, notes, and snippets.

View eintopf's full-sized avatar

Bennet Jeutter eintopf

  • Pixelsplit
  • Frankfurt am Main
View GitHub Profile
@eintopf
eintopf / CassandraSchemaGenerator.java
Last active April 29, 2017 21:21
Since the Datastax driver currently does not support the Auto-Creation of table schema I created this class. It creates the create queries (strings). The execution has to be done in another step. The original problem originates from here: http://stackoverflow.com/questions/32953050/datastax-cassandra-java-driver-object-mapper-auto-create-tables
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
@eintopf
eintopf / NavMeshPlayerMovement.cs
Created December 23, 2016 12:00
This class is an addition to the Unity Standard Asset Scripts (need to be imported in your project to get this gist working). This component can be used like the standard asset "First Person Controller", however it moves on the NavMesh (instead of colliders). This can save a lot of setup pain and performance.
using System;
using UnityEngine;
using UnityEngine.AI;
using UnityStandardAssets.Characters.FirstPerson;
using UnityStandardAssets.CrossPlatformInput;
namespace ZKW.PlayerMovement
{
public class NavMeshPlayerMovement : MonoBehaviour
{
@eintopf
eintopf / EntityManagerTryExtension.cs
Created August 11, 2021 16:28
Allows avoiding repeating HasComponent ? GetComponentData : default pattern. Extension method for Entity Manager in Unity Entities.
using Unity.Entities;
public static class EntityManagerTryExtension
{
public static bool TryGetComponentData<T>(this EntityManager em, in Entity e, out T data) where T : struct, IComponentData
{
if (em.HasComponent<T>(e))
{
data = em.GetComponentData<T>(e);
return true;