Add Prefab VideoContainer + BT-Handler for playing Videos per AVPro

This commit is contained in:
Nadine Ganz 2025-07-14 15:14:17 +02:00
parent 121140c493
commit 2469e4d8b0
21 changed files with 1767 additions and 3628 deletions

0
Viagg-io/Assets/Materials.meta Normal file → Executable file
View File

View File

@ -0,0 +1,193 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AVProVideo 1
m_Shader: {fileID: 4800000, guid: 0ed1fb9218ad96f49acfdb428d5b5aab, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- ALPHAPACK_TOP_BOTTOM
- APPLY_GAMMA
- MONOSCOPIC
- STEREO_TOP_BOTTOM
m_InvalidKeywords:
- FORCEEYE_NONE
- LAYOUT_NONE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AfterTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ChromaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ChromaTex_R:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FromTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex_R:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SrcTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- AlphaPack: 1
- ForceEye: 0
- Layout: 0
- Stereo: 1
- _Alpha: 1
- _AlphaClip: 0
- _AlphaToMask: 0
- _ApplyGamma: 1
- _Aspect: 1
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _Brightness: 0.5
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ColorMask: 15
- _Contrast: 0.5
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EdgeFeather: 0.02
- _EnvironmentReflections: 1
- _Exposure: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HighQuality: 0
- _Hue: 0
- _InvGamma: 1
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Rotation: 0
- _Saturation: 0.5
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _StereoDebug: 0
- _Surface: 0
- _UseHSBC: 0
- _UseYpCbCr: 0
- _VertScale: 1
- _WorkflowMode: 1
- _ZWrite: 1
- _t: 0.5
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _CustomScale: {r: 0, g: 0, b: 0, a: 0}
- _DrawOffset: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
m_BuildTextureStacks: []
--- !u!114 &6336574236004663190
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3305671f5a40919428aa7935750308d7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,193 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AVProVideo
m_Shader: {fileID: 4800000, guid: 0ed1fb9218ad96f49acfdb428d5b5aab, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- ALPHAPACK_TOP_BOTTOM
- APPLY_GAMMA
- MONOSCOPIC
- STEREO_TOP_BOTTOM
m_InvalidKeywords:
- FORCEEYE_NONE
- LAYOUT_NONE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AfterTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ChromaTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ChromaTex_R:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FromTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex_R:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SrcTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- AlphaPack: 1
- ForceEye: 0
- Layout: 0
- Stereo: 1
- _Alpha: 1
- _AlphaClip: 0
- _AlphaToMask: 0
- _ApplyGamma: 1
- _Aspect: 1
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _Brightness: 0.5
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ColorMask: 15
- _Contrast: 0.5
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EdgeFeather: 0.02
- _EnvironmentReflections: 1
- _Exposure: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HighQuality: 0
- _Hue: 0
- _InvGamma: 1
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Rotation: 0
- _Saturation: 0.5
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _StereoDebug: 0
- _Surface: 0
- _UseHSBC: 0
- _UseYpCbCr: 0
- _VertScale: 1
- _WorkflowMode: 1
- _ZWrite: 1
- _t: 0.5
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _CustomScale: {r: 0, g: 0, b: 0, a: 0}
- _DrawOffset: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
m_BuildTextureStacks: []
--- !u!114 &6336574236004663190
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2251b73870fed5b4fb653bb444096303
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,147 @@
//============= Copyright (c) Ludic GmbH, All rights reserved. ==============
//
// Purpose: Part of the My Behaviour Tree Controller Code
//
//=============================================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
using MyBT;
using RenderHeads.Media.AVProVideo;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor(typeof(NamedAVProMediaPlayer))]
public class NamedAVProMediaPlayerInspector : ComponentHandlerInspector
{
}
#endif
[System.Serializable]
public class NamedAVProMediaPlayer : ComponentHandler
{
public override string TypeLabel()
{
return "MediaPlayer";
}
public override string ContentLabel()
{
UpdateComponent();
return videoName;
}
public override void UpdateComponent()
{
base.UpdateComponent();
_mediaPlayer = GetComponent<MediaPlayer>();
if (_mediaPlayer == null)
{
Debug.Log($"NamedAVProMediaPlayer.UpdateComponent mediaPlayer is null");
}
}
//public Depthkit.Clip depthkitClip;
public string videoPath;
public string videoName = "Video";
MediaPlayer _mediaPlayer;
public override string titleText
{
get
{
return "Show/Hide, Run AVPro Video";
}
}
public override string[][] helpText
{
get
{
return new string[][] {
new string[] {"Show", null, $"BTC.Show(\"{roomId}\", \"{gameObject.name}\")"},
new string[] {"Hide", null, $"BTC.Hide(\"{roomId}\", \"{gameObject.name}\")"},
new string[] {"Run", null, $"BTC.Run(\"{roomId}\", \"{gameObject.name}\")"}
};
}
}
public override void Run(MyBT.NodeState nodeState)
{
if (_mediaPlayer == null)
{
Debug.Log("NamedAVProMediaPlayer.Running: MediaPlayer is null.");
return;
}
switch (nodeState)
{
case NodeState.FirstRun:
_mediaPlayer.OpenMedia(new MediaPath(videoPath, MediaPathType.RelativeToPersistentDataFolder));
break;
case NodeState.Running:
if (_mediaPlayer.Loop && _mediaPlayer.Control.IsPlaying())
{
Task.SetSucceeded();
return;
}
if (_mediaPlayer.Control.IsFinished())
{
_mediaPlayer.CloseMedia();
_mediaPlayer.ForceDispose();
Task.SetSucceeded();
return;
}
break;
}
}
public override void Show(MyBT.NodeState nodeState)
{
switch (nodeState)
{
case NodeState.FirstRun:
gameObject.SetActive(true);
if (_mediaPlayer != null)
{
_mediaPlayer.OpenMedia(new MediaPath(videoPath, MediaPathType.RelativeToPersistentDataFolder), autoPlay: false);
}
goto case NodeState.Running;
case NodeState.Running:
Task.SetSucceeded();
break;
case NodeState.Aborting:
break;
}
}
public override void Hide(MyBT.NodeState nodeState)
{
switch (nodeState)
{
case NodeState.FirstRun:
if (_mediaPlayer != null)
{
if (_mediaPlayer.Control.IsPlaying())
{
_mediaPlayer.Stop();
_mediaPlayer.CloseMedia();
}
_mediaPlayer.ForceDispose();
}
Task.SetSucceeded();
break;
case NodeState.Aborting:
break;
case NodeState.NotRunning:
break;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fa9f474abde1d48d2ae77a9cbe255b8b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

0
Viagg-io/Assets/Prefabs.meta Normal file → Executable file
View File

View File

@ -0,0 +1,393 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5678524622008621035
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6950261997647933274}
- component: {fileID: 5089720956894615630}
- component: {fileID: 3167518112041466795}
- component: {fileID: 1963415286702983693}
m_Layer: 0
m_Name: video-actor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6950261997647933274
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5678524622008621035}
serializedVersion: 2
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.34, y: 0.34, z: 0.20263314}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 45992302152454030}
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!33 &5089720956894615630
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5678524622008621035}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &3167518112041466795
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5678524622008621035}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 2251b73870fed5b4fb653bb444096303, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &1963415286702983693
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5678524622008621035}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f6d1977a52888584496b1acc7e998011, type: 3}
m_Name:
m_EditorClassIdentifier:
_media: {fileID: 6597935333783015301}
_automaticStereoPacking: 1
_overrideStereoPacking: 0
_stereoRedGreenTint: 0
_defaultTexture: {fileID: 0}
_renderer: {fileID: 3167518112041466795}
_materialIndex: -1
_texturePropertyName: _MainTex
_offset: {x: 0, y: 0}
_scale: {x: 1, y: 1}
--- !u!1 &6234806968843249386
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 45992302152454030}
- component: {fileID: 3859337681287528449}
m_Layer: 0
m_Name: video-container
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &45992302152454030
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6234806968843249386}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 2.67}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8630740983880984451}
- {fileID: 6950261997647933274}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3859337681287528449
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6234806968843249386}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 96a2d527c1352854b98e30bfd2a38812, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 0}
lookAxis: 2
allowedRotationAxis: 1
--- !u!1 &8285125232897659694
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8630740983880984451}
- component: {fileID: 6597935333783015301}
m_Layer: 0
m_Name: MediaPlayer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8630740983880984451
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8285125232897659694}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 45992302152454030}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &6597935333783015301
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8285125232897659694}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 638c870cac4da414fba921606d504407, type: 3}
m_Name:
m_EditorClassIdentifier:
_mediaSource: 1
_mediaReference: {fileID: 0}
_mediaPath:
_pathType: 2
_path: C0066-ap-tb.mp4
_fallbackMediaHints:
transparency: 1
alphaPacking: 1
stereoPacking: 0
_autoOpen: 1
_autoPlayOnStart: 1
_loop: 1
_audioVolume: 1
_audioBalance: 0
_audioMuted: 0
_playbackRate: 1
_useResampler: 0
_resampleMode: 0
_resampleBufferSize: 5
_videoMapping: 0
_textureFilterMode: 1
_textureWrapMode: 1
_textureAnisoLevel: 0
_sideloadSubtitles: 0
_subtitlePath:
_pathType: 2
_path:
_audioHeadTransform: {fileID: 0}
_audioFocusEnabled: 0
_audioFocusTransform: {fileID: 0}
_audioFocusWidthDegrees: 90
_audioFocusOffLevelDB: 0
_httpHeaders:
httpHeaders: []
_keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
_events:
m_PersistentCalls:
m_Calls: []
_eventMask: -1
_pauseMediaOnAppPause: 1
_playMediaOnAppUnpause: 1
_persistent: 0
_forceFileFormat: 0
_optionsWindows:
httpHeaders:
httpHeaders: []
keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
videoApi: 0
useHardwareDecoding: 1
useRendererSync: 1
useTextureMips: 0
use10BitTextures: 0
hintAlphaChannel: 0
useLowLatency: 0
useCustomMovParser: 0
useHapNotchLC: 0
useStereoDetection: 1
useTextTrackSupport: 1
useFacebookAudio360Support: 1
useAudioDelay: 0
forceAudioOutputDeviceName:
preferredFilters: []
_audioMode: 0
audio360ChannelMode: 0
startWithHighestBitrate: 0
useLowLiveLatency: 0
parallelFrameCount: 3
prerollFrameCount: 4
useUnityAudio: 0
enableAudio360: 0
_options_macOS:
httpHeaders:
httpHeaders: []
keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
textureFormat: 0
_audioMode: 0
_flags: 0
maximumPlaybackRate: 2
_preferredPeakBitRate: 0
_preferredPeakBitRateUnits: 1
_preferredForwardBufferDuration: 0
_preferredMaximumResolution: 0
_customPreferredMaximumResolution: {x: 0, y: 0}
_options_iOS:
httpHeaders:
httpHeaders: []
keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
textureFormat: 0
_audioMode: 0
_flags: 0
maximumPlaybackRate: 2
_preferredPeakBitRate: 0
_preferredPeakBitRateUnits: 1
_preferredForwardBufferDuration: 0
_preferredMaximumResolution: 0
_customPreferredMaximumResolution: {x: 0, y: 0}
_options_tvOS:
httpHeaders:
httpHeaders: []
keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
textureFormat: 0
_audioMode: 0
_flags: 0
maximumPlaybackRate: 2
_preferredPeakBitRate: 0
_preferredPeakBitRateUnits: 1
_preferredForwardBufferDuration: 0
_preferredMaximumResolution: 0
_customPreferredMaximumResolution: {x: 0, y: 0}
_options_visionOS:
httpHeaders:
httpHeaders: []
keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
textureFormat: 0
_audioMode: 0
_flags: 0
maximumPlaybackRate: 2
_preferredPeakBitRate: 0
_preferredPeakBitRateUnits: 1
_preferredForwardBufferDuration: 0
_preferredMaximumResolution: 0
_customPreferredMaximumResolution: {x: 0, y: 0}
_optionsAndroid:
httpHeaders:
httpHeaders: []
keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
textureFormat: 0
_generateMipmaps: 0
_audioMode: 0
_preferredMaximumResolution: 0
_customPreferredMaximumResolution: {x: 0, y: 0}
_preferredPeakBitRate: 0
_preferredPeakBitRateUnits: 1
videoApi: 2
showPosterFrame: 0
audio360ChannelMode: 0
audio360LatencyMS: 0
preferSoftwareDecoder: 0
forceRtpTCP: 0
forceEnableMediaCodecAsynchronousQueueing: 0
fileOffset: 0
startWithHighestBitrate: 0
minBufferMs: 50000
maxBufferMs: 50000
bufferForPlaybackMs: 2500
bufferForPlaybackAfterRebufferMs: 5000
useFastOesPath: 0
audioOutput: 0
blitTextureFiltering: 0
forceEnableMediaCodecAsyncQueueing: 0
enableAudio360: 0
_optionsWindowsUWP:
httpHeaders:
httpHeaders: []
keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
useHardwareDecoding: 1
useRendererSync: 1
useTextureMips: 0
use10BitTextures: 0
hintOutput10Bit: 0
useLowLatency: 0
videoApi: 1
_audioMode: 0
audio360ChannelMode: 0
startWithHighestBitrate: 0
useLowLiveLatency: 0
_optionsWebGL:
httpHeaders:
httpHeaders: []
keyAuth:
keyServerToken:
overrideDecryptionKeyBase64:
externalLibrary: 0
useTextureMips: 0
m_VideoPath:
m_VideoLocation: 2

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1975db4363180984fb6314cd23581050
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

0
Viagg-io/Assets/Scenes.meta Normal file → Executable file
View File

4247
Viagg-io/Assets/Scenes/Test-Scene-Nick2.unity Normal file → Executable file

File diff suppressed because it is too large Load Diff

0
Viagg-io/Assets/Scenes/Test-Scene-Nick2.unity.meta Normal file → Executable file
View File

0
Viagg-io/Assets/Scripts.meta Normal file → Executable file
View File

View File

@ -0,0 +1,67 @@
using UnityEngine;
public class AxisConstrainedLookAt : MonoBehaviour
{
public Transform target;
public enum LocalAxis { X, Y, Z }
public enum RotationAxis { X, Y, Z }
[Header("Which local axis should point at the target?")]
public LocalAxis lookAxis = LocalAxis.Z;
[Header("Allow rotation only around this world axis")]
public RotationAxis allowedRotationAxis = RotationAxis.Y;
void Update()
{
if (target == null) return;
Vector3 toTarget = target.position - transform.position;
if (toTarget.sqrMagnitude < 0.0001f) return;
// Project direction onto the allowed rotation plane
Vector3 projectedDirection = ProjectDirection(toTarget.normalized, allowedRotationAxis);
if (projectedDirection.sqrMagnitude < 0.0001f) return;
// Get the desired rotation to look at the projected target direction
Quaternion targetRotation = Quaternion.LookRotation(projectedDirection, Vector3.up);
// Adjust rotation so the selected local axis is pointing in that direction
Quaternion localAxisRotation = GetLocalAxisRotation(lookAxis);
// Apply final rotation
transform.rotation = targetRotation * Quaternion.Inverse(localAxisRotation);
}
private Vector3 ProjectDirection(Vector3 direction, RotationAxis axis)
{
switch (axis)
{
case RotationAxis.X:
return Vector3.ProjectOnPlane(direction, Vector3.right);
case RotationAxis.Y:
return Vector3.ProjectOnPlane(direction, Vector3.up);
case RotationAxis.Z:
return Vector3.ProjectOnPlane(direction, Vector3.forward);
default:
return direction;
}
}
private Quaternion GetLocalAxisRotation(LocalAxis axis)
{
switch (axis)
{
case LocalAxis.X:
return Quaternion.LookRotation(Vector3.right, Vector3.up);
case LocalAxis.Y:
return Quaternion.LookRotation(Vector3.up, Vector3.forward); // alternative up
case LocalAxis.Z:
return Quaternion.LookRotation(Vector3.forward, Vector3.up);
default:
return Quaternion.identity;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 96a2d527c1352854b98e30bfd2a38812
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

0
Viagg-io/Assets/StreamingAssets.meta Normal file → Executable file
View File

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6b4672fb7b9491142b2e236684eb126e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b1308315a03f9964b9af1315a1c59625
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: