Instantly share code, notes, and snippets.

View cameraToWorld.cs
void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptureFrame photoCaptureFrame)
{
Matrix4x4 cameraToWorldMatrix;
photoCaptureFrame.TryGetCameraToWorldMatrix(out cameraToWorldMatrix);
Matrix4x4 projectionMatrix;
photoCaptureFrame.TryGetProjectionMatrix(out projectionMatrix);
var imagePosZeroToOne = new Vector2(pixelPos.x / imageWidth, 1 - (pixelPos.y / imageHeight));
var imagePosProjected = (imagePosZeroToOne * 2) - new Vector2(1, 1); // -1 to 1 space
View .gitconfig
[core]
pager = less -cm
quotepath = false
[user]
name = Furuta Yusuke
email = 4415085+tarukosu@users.noreply.github.com
[alias]
# いい感じのグラフでログを表示
View GunScript.cs
using UnityEngine;
public class GunScript : MonoBehaviour {
public ITangoController TangoController;
public GameObject LaserBeam;
bool previousSelectButton = false;
private GameObject muzzle;
...
void Start () {
View originToTangoOrigin.cs
var originToMarker = Matrix4x4.TRS(obj.position, obj.rotation * Quaternion.Euler(90, 0, 0), Vector3.one);
var tangoOriginToMarker = Matrix4x4.TRS(TangoController.transform.position, TangoController.transform.rotation, Vector3.one);
var originToTangoOrigin = originToMarker * tangoOriginToMarker.inverse;
var rot = GetRotationFromMatrix(originToTangoOrigin);
transform.parent.SetPositionAndRotation(originToTangoOrigin.MultiplyPoint(Vector3.zero), rot);
View GunScript.cs
using UnityEngine;
using Vuforia;
public class GunScript : MonoBehaviour {
public ITangoController TangoController;
public GameObject LaserBeam;
public CustomTrackingHandler trackingHandler;
bool previousSelectButton = false;
View CustomTrackingHandler.cs
using System;
using UnityEngine;
using Vuforia;
public class CustomTrackingHandler : MonoBehaviour, ITrackableEventHandler
{
private GameObject target;
private TrackableBehaviour trackableBehaviour;
private TrackableBehaviour.Status currentStatus;
View ITangoController.cs
using UnityEngine;
public interface ITangoController{
bool SelectButton
{
get;
set;
}
Transform transform
View UnetTangoController.cs
using System;
using UnetLLAPISample;
using UnityEngine;
public class UnetTangoController : MonoBehaviour, ITangoController {
public LLAPINetworkManager NetworkManager;
public bool SelectButton { get; set; }
public GunScript GunScript;
private void Awake()
View UnetTangoController.cs
using System;
using System.Collections;
using UnetLLAPISample;
using UnityEngine;
using UnityEngine.Networking;
public class UnetTangoController : MonoBehaviour
{
public LLAPINetworkManager NetworkManager;
public bool SelectButton = false;
View LLAPINetworkManager.cs
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using System;
namespace UnetLLAPISample {
public class LLAPINetworkEventArgs : EventArgs
{
public NetworkEventType eventType { set; get; }
public byte[] data { set; get; }