ShamilJ
UX/UI Designer & Developer
based in New York
Ski x VR
Ski x VR
Ski x VR






using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SkiWithPlayerController : MonoBehaviour
{
public OVRPlayerController playerController;
public float speedToTriggerMovement = 3;
public float moveBy = 2;
public float debugVelocity;
public Transform hand;
private Vector3 previousPosition;
private float startAcc = .01f;
private void Start()
{
startAcc = playerController.Acceleration;
}
private void Update()
{
debugVelocity = (this.hand.localPosition - previousPosition).magnitude / Time.deltaTime;
if ((this.hand.localPosition - previousPosition).magnitude / Time.deltaTime > speedToTriggerMovement)
{
// playerController.MoveThrottle *= moveBy;
playerController.Acceleration = moveBy;
// playerController.GetComponent<CharacterController>().Move(Camera.main.transform.forward * moveBy * Time.deltaTime);
//playerController.moveInfluence *= moveBy;
}
else
{
playerController.Acceleration = startAcc;
}
previousPosition = this.hand.localPosition;
}
}