Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using UnityEngine.EventSystems;
public class SampleEventData : BaseEventData
{
public string SampleStr { get; private set; }
public SampleEventData(EventSystem eventSystem, string sampleStr) : base(eventSystem)
{
SampleStr = sampleStr;
}
using System;
using System.Collections.Generic;
public class SampleEventArgs : EventArgs
{
public int x { get; private set; }
public int y { get; private set; }
public SampleEventArgs(int x, int y) : base()
{
@dykarohora
dykarohora / GazeGestureManagerForEvent.cs
Created February 2, 2017 09:38
Use event system instead of message system.
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.VR.WSA.Input;
public class GazeGestureManager : MonoBehaviour {
public static GazeGestureManager Instance { get; private set; }
public GameObject FocusedObject { get; private set; }
GestureRecognizer recognizer;
@dykarohora
dykarohora / SphereCommandsForEvent.cs
Created February 2, 2017 09:40
Use event system instead of message system.
using UnityEngine;
using UnityEngine.EventSystems;
public class SphereCommandsForEvent : MonoBehaviour, ISelectable {
public void OnSelect() {
if(!this.GetComponent<Rigidbody>()) {
var rigidbody = this.gameObject.AddComponent<Rigidbody>();
rigidbody.collisionDetectionMode = CollisionDetectionMode.Continuous;
}
using HoloToolkit.Unity;
using HoloToolkit.Unity.InputModule;
using UnityEngine;
public class PositionController : MonoBehaviour, IInputHandler, ISourceStateHandler {
public GameObject target;
private Interpolator interpolator;
public bool IsDraggingEnable = true;
private bool isDragging;
using HoloToolkit.Unity.InputModule;
using UnityEngine;
public class RotationController : MonoBehaviour, IInputHandler, ISourceStateHandler {
public GameObject target;
public bool IsDraggingEnable = true;
private bool isDragging;
private Camera mainCamera;
using HoloToolkit.Unity.InputModule;
using UnityEngine;
public class ScaleController : MonoBehaviour, IInputHandler, ISourceStateHandler {
public GameObject target;
public bool IsDraggingEnable = true;
private bool isDragging;
private Camera mainCamera;
using UnityEngine;
public class TransformController : MonoBehaviour {
[HideInInspector]
public GameObject target;
#region Position
public static float distanceScale = 2f;
#endregion
@dykarohora
dykarohora / BoundingBox.cs
Created June 21, 2017 00:30
SkinnedMeshRendererを使ってるオブジェクトに対してBoundingBoxが上手く使えない事象に対象する対処コード。とりあえず動作するが、遠回りな手順を取っているので、本来はBoundsの拡張メソッドも修正した方がよい。
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
//
using HUX.Buttons;
using HUX.Focus;
using HUX.Receivers;
using System.Collections.Generic;
using UnityEngine;
@dykarohora
dykarohora / BoundingBoxTarget.cs
Created June 28, 2017 09:04
動的にBoundingBoxTargetなオブジェクトを生成できるよう暫定修正。Startにコードを追加している。
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
//
using HUX.Buttons;
using UnityEngine;
namespace HUX.Interaction
{
/// <summary>