Skip to content

Instantly share code, notes, and snippets.

View sanderman01's full-sized avatar

Alexander Verbeek sanderman01

View GitHub Profile
public static void ResizeTexture(UnityEngine.Texture2D source, int newWidth, int newHeight, UnityEngine.FilterMode filterMode)
{
// save the old filtervalue on the source texture before changing it, so we can restore it later.
UnityEngine.FilterMode sourceFilterMode = source.filterMode;
source.filterMode = filterMode;
// use a temporary render texture to for the image data conversion
UnityEngine.RenderTexture rt = UnityEngine.RenderTexture.GetTemporary(newWidth, newHeight);
rt.filterMode = UnityEngine.FilterMode.Point;
UnityEngine.RenderTexture.active = rt;
@sanderman01
sanderman01 / OrbitCamera.cs
Created October 29, 2015 10:02
Orbital Camera in Unity
using UnityEngine;
using System.Collections;
/// <summary>
/// Defines angle limits as the maximum deviation away from the rotation of this object.
/// (in other words: if the yawlimit is 45, then you can only move up to 45 degrees away from this rotation in both directions.
/// This means the total angle available would be an angle of 90 degrees)
/// An angle of 180 allows complete freedom of movement on that axis.
/// </summary>
public class FocusPoint : MonoBehaviour