Add function to rotate XR Origin, add rotations in BT

This commit is contained in:
Nadine Ganz 2025-03-26 13:30:49 +01:00
parent a8ff9dcf22
commit c97ccef80c
6 changed files with 57 additions and 12 deletions
Viagg-io/Assets

@ -12,12 +12,11 @@
}
Composite(Sequence) {
//RunTree("32_Grotto_Story_B_Grotto_Intro")
RunTree("32_Grotto_Story_B_Grotto_Intro")
//RunTree("32_Grotto_Story_B_Grotto_Antwort_Nonna_Grotto")
//BTC.SetPosition("GO.XRInteractionHandsSetup.XROrigin", -7.036, 0, -16.413)
//BTC.SetPosition("GO.HANDMENU", -7.036, 0, -16.413)
RunTree("32_Grotto_Kueche_Intro")
//RunTree("32_Grotto_Kueche_Init")
//RunTree("32_Grotto_Kueche_Intro")
//RunTree("32_Grotto_Kueche_Zwiebeln_schneiden")
//RunTree("32_Grotto_Kueche_alles_gefunden")
//RunTree("32_Grotto_Kueche_Interesse_Kochen")
@ -437,6 +436,7 @@ Tree("32_Grotto_Story_B_Grotto_Antwort_Nonna_Kueche") {
}
}
RunTree("32_Grotto_Kueche_Init")
RunTree("32_Grotto_Kueche_Intro")
}
}
@ -550,19 +550,26 @@ Tree("32_Grotto_Story_B_Grotto_Antwort_Nonna_Grotto") {
BTC.Run("Depthkit.VIDEOS.AntwortNonnaGrotto_15")
BTC.Hide("Depthkit.VIDEOS.AntwortNonnaGrotto_15")
RunTree("32_Grotto_Im_Grotto_Essen_Init")
RunTree("32_Grotto_Im_Grotto_Essen_Intro")
}
}
Tree("32_Grotto_Kueche_Init") {
Composite(Marathon) {
// Initialization
//BTC.Run("StudioEventEmitter.STATIC.Ambi3D")
BTC.StopSound("StudioEventEmitter.STATIC.AmbiGarten")
BTC.SetPosition("GO.XRInteractionHandsSetup.XROrigin", -7.036, 0, -16.413)
BTC.SetPosition("GO.HANDMENU", -7.036, 0, -16.413)
BTC.RotateToAngle("GO.XRInteractionHandsSetup.XROrigin", 90.0)
BTC.RotateToAngle("GO.HANDMENU", 90.0)
}
}
Tree("32_Grotto_Kueche_Intro") {
// --- Kueche - Intro ---
Composite(Sequence) {
// Initialization
//BTC.Run("StudioEventEmitter.STATIC.Ambi3D")
BTC.StopSound("StudioEventEmitter.STATIC.AmbiGarten")
BTC.SetPosition("GO.XRInteractionHandsSetup.XROrigin", -7.036, 0, -16.413)
BTC.SetPosition("GO.HANDMENU", -7.036, 0, -16.413)
BTC.Show("Depthkit.VIDEOS.Intro1Kueche")
BTC.Run("Depthkit.VIDEOS.Intro1Kueche")
BTC.Hide("Depthkit.VIDEOS.Intro1Kueche")
@ -1413,6 +1420,8 @@ Tree("32_Grotto_Im_Grotto_Essen_Init") {
Composite(Marathon) {
BTC.SetPosition("GO.XRInteractionHandsSetup.XROrigin", -4.648, 0, -12.295)
BTC.SetPosition("GO.HANDMENU", -4.648, 0, -12.295)
BTC.RotateToAngle("GO.XRInteractionHandsSetup.XROrigin", 0.0)
BTC.RotateToAngle("GO.HANDMENU", 0.0)
BTC.Run("StudioEventEmitter.STATIC.KuechenAmbi")
BTC.Run("StudioEventEmitter.STATIC.AmbiGarten")
//BTC.StopSound("StudioEventEmitter.STATIC.Ambi3D")
@ -1900,6 +1909,8 @@ Tree("32_Grotto_Im_Grotto_Essen_Intro") {
// --- Im Grotto Essen - Outro ---
BTC.SetPosition("GO.XRInteractionHandsSetup.XROrigin", -1.14, 0, 1.698)
BTC.SetPosition("GO.HANDMENU", -1.14, 0, 1.698)
BTC.RotateToAngle("GO.XRInteractionHandsSetup.XROrigin", 60.0)
BTC.RotateToAngle("GO.HANDMENU", 60.0)
BTC.Show("Depthkit.VIDEOS.Outro1ImGrottoesse")
BTC.Run("Depthkit.VIDEOS.Outro1ImGrottoesse")

@ -265,6 +265,18 @@ public class BTC : MonoBehaviour {
}
}
[Task]
public void RotateToAngle(string objectName, float newAngle)
{
List<ComponentHandler> handlers = GetHandlers(objectName);
handlers.ForEach(handler => handler.RotateToAngle(Task.getState, newAngle));
if (handlers.Count == 0)
{
Debug.LogWarning($"BTC.RotateToAngle: no components under the name '{objectName}'");
Task.SetSucceeded();
}
}
[Task]
public void AbortEventListener(string objectName)
{

@ -213,6 +213,14 @@ public class ComponentHandler : MonoBehaviour {
}
}
public virtual void RotateToAngle(MyBT.NodeState nodeState, float newAngle)
{
if (Task.isDebugging)
{
Debug.LogWarning($"ComponentHandler.RotateToAngle: not implemented for {this.GetType()}");
}
}
public virtual void AbortEventListener(MyBT.NodeState nodeState)
{
if (Task.isDebugging)

@ -91,6 +91,16 @@ public class NamedGameObject : ComponentHandler {
}
}
public override void RotateToAngle(NodeState nodeState, float targetAngle)
{
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
{
// Rotate y-Achse
gameObject.transform.rotation = Quaternion.Euler(0, targetAngle, 0);
Task.SetSucceeded();
}
}
public GameObject go;
public string objName = "GoXY";
}

@ -1678,7 +1678,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &784431681836084746
RectTransform:
m_ObjectHideFlags: 0

@ -13196,6 +13196,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8253431605697638319, guid: 60c78457019c15140b2e111cef443df3, type: 3}
propertyPath: m_Convex
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -81918,7 +81922,7 @@ MonoBehaviour:
overrideLogStringDisplay: 0
overrideDebugInternalActive: 0
overrideDebugChangesActive: 0
instanceID: 4665756
instanceID: 407002
__behaviourTreeGenerator: {fileID: 0}
taskScripts:
- {fileID: 4900000, guid: 7100bc138828c402baf6fdd9c426735b, type: 3}