Skip to content

Instantly share code, notes, and snippets.

View 314pies's full-sized avatar
💭
What's code? Can I eat it?

314pies 314pies

💭
What's code? Can I eat it?
  • Amazon
  • California
  • 00:36 (UTC -07:00)
View GitHub Profile
private void UpdateFood(float dt, bool forceUpdate)
{
this.m_foodUpdateTimer += dt;
if (this.m_foodUpdateTimer >= 1f || forceUpdate)
{
this.m_foodUpdateTimer -= 1f;
foreach (Player.Food food in this.m_foods)
{
food.m_time -= 1f;
float num = Mathf.Clamp01(food.m_time / food.m_item.m_shared.m_foodBurnTime);
public void PokeRigidBody()
{
//Make sure to import TouchScreenWrap.cs first
if (TouchScreenWrap.touches.Length > 0)
{
var ray = cam.ScreenPointToRay(TouchScreenWrap.touches[0].position);
RaycastHit hit;
//Our finger poke on something with collider
if (Physics.Raycast(ray, out hit)) {
if (hit.transform.GetComponent<Rigidbody>() != null)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;
public class ARRaycasting : MonoBehaviour
{
public GameObject cube;
[SerializeField]
public Transform handTransform;
void Update()
{
if (OVRInput.GetDown(OVRInput.Button.PrimaryHandTrigger))
{
//Do something when click the button on the VR controller
}
//Get thumbstick input
var ray = cam.ScreenPointToRay(TouchScreenWrap.touches[0].position);
RaycastHit hit;
if (Physics.Raycast(ray, out hit)) {
if (hit.transform.GetComponent<Rigidbody>() != null)
{
Vector3 offSet = hit.transform.position - cam.transform.position;
hit.transform.GetComponent<Rigidbody>().AddForce(offSet.normalized * Force, ForceMode.VelocityChange);
}
}
namespace Tmp
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
[Serializable]
public class mazeCube
{
public GameObject VP;
public GameObject Prefab;
public Transform hand;
GameObject theObj;
public float speed = 300.0f;
// Update is called once per frame
void Update()
{
//For getting button(s)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
[Serializable]
public class mazeCube
{
public int preFabType;
public Vector3 pos;
void Update()
{
foreach (Touch _touch in TouchScreenInputWrapper.touches)
{
if (_touch.phase == TouchPhase.Began) {
Ray ray = Camera.main.ScreenPointToRay(_touch.position);
//This can show the ray in the editor scene windows.
Debug.DrawRay(ray.origin, ray.direction * 10, Color.yellow, duration: 3);
RaycastHit hit;
Physics.Raycast(ray: ray, hitInfo: out hit, maxDistance: 100);
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UpdatePlayerRespawnPoint : MonoBehaviour
{
public Vector3 RespawnPoint;
private void OnTriggerEnter(Collider other)
{
//if the enter object is the player