Skip to content

Instantly share code, notes, and snippets.

View ryoojw's full-sized avatar

ryoojw ryoojw

View GitHub Profile
@ryoojw
ryoojw / OutOfBounds.cs
Last active January 29, 2018 11:28
Respawn Bug Code
namespace TanksMP
{
public class OutOfBounds : PunBehaviour {
//Server only: check for players colliding with the out of bounds
void OnCollisionEnter(Collision col)
{
if (!PhotonNetwork.isMasterClient) return;
//cache corresponding gameobject that was hit
@ryoojw
ryoojw / FollowGround.js
Created January 21, 2017 15:55
Unity follow ground javascript script. Uses raycast to make the object 'stick' to the ground.
// You should change the center of this gameObject's mesh from default value (0,0,0).
// Because this script put its point to the contact point with the ground.
// And "use gravity" must be FALSE.
// Call HitTestWithRoad() from Update()
public var distance:float = 2.0;
public var smoothRatio:float = 0.2;
function HitTestWithRoad() {
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
using System.Collections.Generic;
[RequireComponent(typeof(Image))]
[RequireComponent(typeof(Mask))]
[RequireComponent(typeof(ScrollRect))]
public class ScrollSnapRect : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler {