(j'avais expliqué mon projet dans un autre dossier mais je réexplique:
Je travaille sur un projet BCI, neuroscience, cad qu'avec un casque permettant de capturer les "streams" musculaires des yeux je voudrais pouvoir bouger un game.object dans une scène.
1- voici mon script: effectivement j'ai rajouté une ligne de codes permettant en fonction du stream reçue de bouger soit en horizontal, ou vertical. Je lui ai rajouté un AddForce. Actuellement mon game.object ne bouge qu'avec ce dernier.
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Assets.LSL4Unity.Scripts;
using System.Linq;
using Assets.LSL4Unity.Scripts.Examples;
public class BaliseController : MonoBehaviour {
public float speed =0.0f;
private LSLMarkerStream marker;
private Rigidbody rb;
private ExampleFloatInlet inlet;
void Start()
{
inlet=FindObjectOfType<ExampleFloatInlet>();
rb = GetComponent<Rigidbody> ();
marker=FindObjectOfType<LSLMarkerStream>();
}
void OnTriggerEnter (Collider other){
if (other.CompareTag ("LIGHT")) {
marker.Write ("Collision on" + this.name);
other.gameObject.SetActive (false);
}
}
void FixedUpdate(){
float MoveHorizontal = 0;
if(inlet.lastSample.Length > 0)
MoveHorizontal=inlet.lastSample[0];
float MoveVertical = Input.GetAxis ("Vertical");
Vector3 movement=new Vector3 (MoveHorizontal, 0.0f, MoveVertical);
GetComponent<Rigidbody>().AddForce(movement * speed * Time.deltaTime);
} }
2- Ce que je vois sur ma console ( en debug.Log). Entre temps j'ai rajouté un "ToString". http://fr.tinypic.com/r/noy9mx/9
3- Mes questions sont à votre avis, est ce que il faut que je regarde dans les paramètres des axis?, c'est cette formule qu'il faut que je change?
Code : Tout sélectionner
void FixedUpdate(){
float MoveHorizontal = 0;
if(inlet.lastSample.Length > 0)
MoveHorizontal=inlet.lastSample[0];
float MoveVertical = Input.GetAxis ("Vertical");