add virtual phone

This commit is contained in:
2026-01-03 17:26:08 +01:00
parent 655c38ef45
commit f38cfaf677
12 changed files with 246 additions and 246 deletions

View File

@@ -1,30 +0,0 @@
%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: Custom_ExternalViewportShader
m_Shader: {fileID: 4800000, guid: 3e77e5f97efb4412fade3b2ed3c01b58, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats: []
m_Colors: []
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

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

View File

@@ -1,54 +0,0 @@
Shader "Custom/ExternalViewportShader"
{
Properties
{
//_MainTex ("External Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" "Queue"="Geometry" }
LOD 100
Pass
{
// GLSLPROGRAM block is required for raw GLSL in Unity
GLSLPROGRAM
// 1. Enable the EGL Image External extension for Android
//#extension GL_OES_EGL_image_external_essl3 : require
// Unity 6 predefines VERTEX and FRAGMENT during separate compilation passes
#ifdef VERTEX
// Unity 6 uses built-in matrices but they must be declared or used via Unity-specific naming
// In raw GLSL, we use the standard attribute/varying naming convention
varying vec2 v_texcoord;
void main()
{
// gl_ModelViewProjectionMatrix is still available in Unity's GLSL compatibility layer
gl_Position = gl_Vertex;
v_texcoord = gl_MultiTexCoord0.xy;
}
#endif
#ifdef FRAGMENT
// 2. Use samplerExternalOES for AHardwareBuffer data
//uniform samplerExternalOES _MainTex;
varying vec2 v_texcoord;
void main()
{
// 3. For Unity 6, use textureExternal for maximum compatibility
// on GLES3 devices to ensure the compiler handles the conversion properly.
// texture2D(s, coord) also works, but textureExternal is the modern Unity GLSL recommendation.
gl_FragColor = vec4(1, 0, 0, 1);//texture2D(_MainTex, v_texcoord);
}
#endif
ENDGLSL
}
}
Fallback "Unlit/Texture"
}

View File

@@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 3e77e5f97efb4412fade3b2ed3c01b58
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

19
Assets/PhoneRotator.cs Normal file
View File

@@ -0,0 +1,19 @@
using Unity.Mathematics;
using UnityEngine;
public class PhoneRotator : MonoBehaviour
{
Quaternion initialRotation;
public float swingRange = 30f; // In Degrees
public float speed = 2f;
void Start()
{
initialRotation = GetComponent<Transform>().localRotation;
}
void Update()
{
float currentDegrees = Mathf.Sin(Time.time * speed) * swingRange;
Quaternion swingRotation = Quaternion.Euler(0, 0, currentDegrees);
GetComponent<Transform>().localRotation = initialRotation * swingRotation;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 09aeceeed7332448bb26014d1731bcc7

View File

@@ -7,7 +7,6 @@ public class KotlinBridge : MonoBehaviour
{
static KotlinBridge Instance;
Texture2D texture;
[SerializeField] private Shader oesShader;
[StructLayout(LayoutKind.Sequential)]
struct NativeCallbacks
{
@@ -65,7 +64,7 @@ public class KotlinBridge : MonoBehaviour
UnityMainThreadDispatcher.Enqueue(() => {
var renderer = Instance.GetComponent<Renderer>();
//renderer.material = new Material(Instance.oesShader);
renderer.material.mainTexture = Texture2D.CreateExternalTexture(1024, 1024,
renderer.materials[2].mainTexture = Texture2D.CreateExternalTexture(1024, 1024,
TextureFormat.RGBA32, false, false, (IntPtr)gl_texture);
});
}

View File

@@ -119,146 +119,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &82054816
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 82054821}
- component: {fileID: 82054820}
- component: {fileID: 82054819}
- component: {fileID: 82054818}
- component: {fileID: 82054817}
- component: {fileID: 82054822}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &82054817
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 82054816}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30d423b9d44d240e7a5d6bf14c711e45, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp-firstpass::KotlinBridge
oesShader: {fileID: 4800000, guid: 3e77e5f97efb4412fade3b2ed3c01b58, type: 3}
--- !u!64 &82054818
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 82054816}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &82054819
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 82054816}
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_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 3a1598b3e740546d3af33e896a250511, 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_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &82054820
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 82054816}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &82054821
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 82054816}
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.2253248, y: 0.2253248, z: 0.2253248}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!114 &82054822
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 82054816}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b7bfde52f3a724ee3b494287fcd0aa8e, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp-firstpass::UnityMainThreadDispatcher
--- !u!1 &519420028
GameObject:
m_ObjectHideFlags: 0
@@ -271,6 +131,7 @@ GameObject:
- component: {fileID: 519420031}
- component: {fileID: 519420029}
- component: {fileID: 519420030}
- component: {fileID: 519420033}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@@ -364,7 +225,7 @@ Camera:
near clip plane: 0.3
far clip plane: 1000
field of view: 34
orthographic: 1
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
@@ -396,6 +257,18 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &519420033
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b7bfde52f3a724ee3b494287fcd0aa8e, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp-firstpass::UnityMainThreadDispatcher
--- !u!1 &619394800
GameObject:
m_ObjectHideFlags: 0
@@ -480,10 +353,108 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1876041952
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalPosition.x
value: -0.01
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalPosition.y
value: -0.903675
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalPosition.z
value: -6.3
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalRotation.w
value: 0.9248187
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalRotation.x
value: -0.3804082
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -44.718
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -7511558181221131132, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: 'm_Materials.Array.data[2]'
value:
objectReference: {fileID: 2100000, guid: 3a1598b3e740546d3af33e896a250511, type: 2}
- target: {fileID: 919132149155446097, guid: f200897b2392745ef8446be3a91dc938, type: 3}
propertyPath: m_Name
value: phone
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: f200897b2392745ef8446be3a91dc938, type: 3}
insertIndex: -1
addedObject: {fileID: 1876041954}
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: f200897b2392745ef8446be3a91dc938, type: 3}
insertIndex: -1
addedObject: {fileID: 1876041958}
m_SourcePrefab: {fileID: 100100000, guid: f200897b2392745ef8446be3a91dc938, type: 3}
--- !u!1 &1876041953 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: f200897b2392745ef8446be3a91dc938, type: 3}
m_PrefabInstance: {fileID: 1876041952}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1876041954
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876041953}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30d423b9d44d240e7a5d6bf14c711e45, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp-firstpass::KotlinBridge
--- !u!114 &1876041958
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1876041953}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 09aeceeed7332448bb26014d1731bcc7, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PhoneRotator
swingRange: 30
speed: 2
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 519420032}
- {fileID: 619394802}
- {fileID: 82054821}
- {fileID: 1876041952}

View File

@@ -7,7 +7,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Material
m_Name: ScreenMaterial
m_Shader: {fileID: 4800000, guid: 13c02b14c4d048fa9653293d54f6e0e1, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0

BIN
Assets/phone.fbx Normal file

Binary file not shown.

110
Assets/phone.fbx.meta Normal file
View File

@@ -0,0 +1,110 @@
fileFormatVersion: 2
guid: f200897b2392745ef8446be3a91dc938
ModelImporter:
serializedVersion: 24200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
generateMeshLods: 0
meshLodGenerationFlags: 0
maximumMeshLod: -1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant: