Lier la vitesse du vélo à la vitesse de la vidéo
This commit is contained in:
parent
a8954747bd
commit
aac6e1fac7
@ -19,13 +19,18 @@ public class BikeManager : MonoBehaviour {
|
||||
private string inputID;
|
||||
private float distancePerTick;
|
||||
private float distanceRun;
|
||||
private float normalSpeed;
|
||||
|
||||
private float Speed {get; set; }
|
||||
|
||||
private Queue<float> impulses = new Queue<float>();
|
||||
|
||||
private VideoManager vm;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
vm = gameObject.GetComponent<VideoManager>();
|
||||
|
||||
// TODO: Refactor w a player manager ?
|
||||
switch (playerID) {
|
||||
case 0:
|
||||
@ -39,6 +44,8 @@ public class BikeManager : MonoBehaviour {
|
||||
distancePerTick = wheelDiameter * Mathf.PI / ticPerTurn;
|
||||
Debug.Log("Distance to run:" + distanceToRun);
|
||||
Debug.Log("Distance per tick:" + distancePerTick);
|
||||
|
||||
normalSpeed = distanceToRun / vm.raceFinishTime;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@ -49,6 +56,8 @@ public class BikeManager : MonoBehaviour {
|
||||
|
||||
Speed = getBikeSpeed(speedIntegrationTime);
|
||||
Debug.Log(Speed);
|
||||
|
||||
vm.speed = Speed / normalSpeed;
|
||||
}
|
||||
|
||||
int getBikeImpulses(float timeWindow = .5f) {
|
||||
|
@ -6,10 +6,11 @@ using UnityEngine.Video;
|
||||
public class VideoManager : MonoBehaviour {
|
||||
|
||||
private VideoPlayer videoPlayer;
|
||||
private float speed {get; set; }
|
||||
public float speed {get; set; }
|
||||
public float raceFinishTime = 30.0f;
|
||||
|
||||
void Start () {
|
||||
speed = 1.0f;
|
||||
speed = 0.0f;
|
||||
videoPlayer = gameObject.AddComponent<VideoPlayer>();
|
||||
// TODO: Aspect Ratio is not working?
|
||||
videoPlayer.aspectRatio = VideoAspectRatio.FitOutside;
|
||||
|
Loading…
Reference in New Issue
Block a user