Fix Slider
This commit is contained in:
@@ -26849,7 +26849,7 @@ MonoBehaviour:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1591058970}
|
m_GameObject: {fileID: 1591058970}
|
||||||
m_Enabled: 0
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
|
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
@@ -26910,7 +26910,7 @@ MonoBehaviour:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1591058970}
|
m_GameObject: {fileID: 1591058970}
|
||||||
m_Enabled: 1
|
m_Enabled: 0
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 2518c50cb3fc6a6458d4b743c2f69c7d, type: 3}
|
m_Script: {fileID: 11500000, guid: 2518c50cb3fc6a6458d4b743c2f69c7d, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
@@ -36785,8 +36785,9 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: a28b3692aca31b141907b971599c1e61, type: 3}
|
m_Script: {fileID: 11500000, guid: a28b3692aca31b141907b971599c1e61, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
basemodel: {fileID: 645201570}
|
basemodel: {fileID: 0}
|
||||||
rotationSlider: {fileID: 2108164464}
|
rotationSlider: {fileID: 2108164464}
|
||||||
|
joystickSpeed: 50
|
||||||
--- !u!114 &2108164464
|
--- !u!114 &2108164464
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -48,6 +48,16 @@ public class BaseModelSelector : MonoBehaviour
|
|||||||
}
|
}
|
||||||
modelManager.LoadSelectedModel(model);
|
modelManager.LoadSelectedModel(model);
|
||||||
|
|
||||||
|
if (sliderHandler != null && modelManager.baseModelGO != null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("Setting BaseModel for SliderHandler");
|
||||||
|
sliderHandler.SetBaseModel(modelManager.baseModelGO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning("Setting BaseModel for SliderHandler geht nit: SliderHandler: " + sliderHandler + ", BaseModelGO: " + modelManager.baseModelGO);
|
||||||
|
}
|
||||||
|
|
||||||
if (portSelector == null)
|
if (portSelector == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("PortSelector is null!");
|
Debug.LogError("PortSelector is null!");
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@@ -6,21 +5,44 @@ public class SilderHandler : MonoBehaviour
|
|||||||
{
|
{
|
||||||
public GameObject basemodel;
|
public GameObject basemodel;
|
||||||
public Slider rotationSlider;
|
public Slider rotationSlider;
|
||||||
private float x;
|
public float joystickSpeed = 50f;
|
||||||
private float z;
|
|
||||||
private float y;
|
private float x, y, z;
|
||||||
|
|
||||||
|
public void SetBaseModel(GameObject model)
|
||||||
|
{
|
||||||
|
basemodel = model;
|
||||||
|
if (basemodel == null)
|
||||||
|
Debug.LogError("SetBaseModel: Übergebenes Modell ist null!");
|
||||||
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
if (rotationSlider != null)
|
if (rotationSlider != null)
|
||||||
{
|
|
||||||
|
|
||||||
rotationSlider.onValueChanged.AddListener(OnSliderValueChanged);
|
rotationSlider.onValueChanged.AddListener(OnSliderValueChanged);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Debug.LogError("RotationSlider ist nicht zugewiesen!");
|
Debug.LogError("RotationSlider ist nicht zugewiesen!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
float joystickInput = 0f;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
joystickInput = Input.GetAxis("Oculus_CrossPlatform_SecondaryThumbstickHorizontal");
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Keine Achse vorhanden oder kein Controller angeschlossen
|
||||||
|
joystickInput = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Mathf.Abs(joystickInput) > 0.1f)
|
||||||
|
{
|
||||||
|
rotationSlider.value += joystickInput * joystickSpeed * Time.deltaTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnSliderValueChanged(float value)
|
private void OnSliderValueChanged(float value)
|
||||||
{
|
{
|
||||||
if (basemodel != null)
|
if (basemodel != null)
|
||||||
@@ -34,6 +56,7 @@ public class SilderHandler : MonoBehaviour
|
|||||||
Debug.LogError("Basemodel ist nicht zugewiesen!");
|
Debug.LogError("Basemodel ist nicht zugewiesen!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getRotation(Quaternion modelRotation)
|
public void getRotation(Quaternion modelRotation)
|
||||||
{
|
{
|
||||||
Vector3 eulerRotation = modelRotation.eulerAngles;
|
Vector3 eulerRotation = modelRotation.eulerAngles;
|
||||||
|
|||||||
Reference in New Issue
Block a user