ADD, Fix : 룰렛 추가 및 옵티트랙 재접속 체크 기능 추가

This commit is contained in:
qsxft258@gmail.com 2026-03-28 00:53:16 +09:00
parent 23e8d85a9e
commit 8cbc4942f3
22 changed files with 5052 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* /*
Copyright © 2016 NaturalPoint Inc. Copyright © 2016 NaturalPoint Inc.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
@ -11,10 +11,11 @@ Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
using System; using System;
using System.Collections;
using KindRetargeting; using KindRetargeting;
using UnityEngine; using UnityEngine;
@ -38,6 +39,8 @@ public class OptitrackRigidBody : MonoBehaviour
private bool m_isRigidBodyFound = false; private bool m_isRigidBodyFound = false;
private int m_resolvedRigidBodyId = -1; private int m_resolvedRigidBodyId = -1;
private const float k_RetryInterval = 1.0f;
public bool isRigidBodyFound public bool isRigidBodyFound
{ {
get { return m_isRigidBodyFound; } get { return m_isRigidBodyFound; }
@ -52,22 +55,52 @@ public class OptitrackRigidBody : MonoBehaviour
return; return;
} }
// Resolve prop name to ID if provided TryResolveRigidBody();
// 초기 해결 실패 시 주기적으로 재시도
if (m_resolvedRigidBodyId == -1 && !string.IsNullOrEmpty(propName))
{
StartCoroutine(RetryResolveCoroutine());
}
}
private void TryResolveRigidBody()
{
if (!string.IsNullOrEmpty(propName)) if (!string.IsNullOrEmpty(propName))
{ {
m_resolvedRigidBodyId = m_streamingClient.GetRigidBodyIdByName(propName); int resolved = m_streamingClient.GetRigidBodyIdByName(propName);
if (m_resolvedRigidBodyId == -1) if (resolved != -1)
{ {
Debug.LogWarning($"OptitrackRigidBody: Could not find rigid body with name '{propName}'", this); m_resolvedRigidBodyId = resolved;
return; m_streamingClient.RegisterRigidBody(this, m_resolvedRigidBodyId);
Debug.Log($"OptitrackRigidBody: '{propName}' 해결 완료 (ID: {m_resolvedRigidBodyId})", this);
} }
} }
else else
{ {
m_resolvedRigidBodyId = rigidBodyId; m_resolvedRigidBodyId = rigidBodyId;
m_streamingClient.RegisterRigidBody(this, m_resolvedRigidBodyId);
} }
}
m_streamingClient.RegisterRigidBody(this, m_resolvedRigidBodyId); private IEnumerator RetryResolveCoroutine()
{
var wait = new WaitForSeconds(k_RetryInterval);
while (m_resolvedRigidBodyId == -1)
{
yield return wait;
if (m_streamingClient == null) yield break;
// 서버에 정의 재조회 요청
m_streamingClient.RequestDefinitionRefresh();
// 다음 프레임까지 대기 (정의 갱신이 Update에서 처리되므로)
yield return null;
TryResolveRigidBody();
}
} }

View File

@ -423,7 +423,9 @@ public class OptitrackSkeletonAnimator_Mingle : MonoBehaviour
} }
else else
{ {
// 스켈레톤 정의를 찾지 못함 → 서버에 정의 재조회 요청
isSkeletonFound = false; isSkeletonFound = false;
StreamingClient.RequestDefinitionRefresh();
} }
} }

View File

@ -407,6 +407,16 @@ public class OptitrackStreamingClient : MonoBehaviour
#endregion Private fields #endregion Private fields
/// <summary>
/// 외부에서 정의 재조회를 요청합니다. 쿨다운(5초) 내에는 무시됩니다.
/// OptitrackRigidBody, OptitrackSkeletonAnimator_Mingle 등에서 에셋을 찾지 못할 때 호출.
/// </summary>
public void RequestDefinitionRefresh()
{
m_pendingDefinitionRefresh = true;
}
private void Update() private void Update()
{ {
if (DrawMarkers) if (DrawMarkers)

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 03f20b4b1a3b7ca4f936e7c7327f34f9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cc24f6684e9427e44a37e8b81571cd06
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0473572383f8cbe4789079d1aa73eea0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a25c7d631daa2df469f82586c330f928
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: 1baa2412aac486f46b745aa50792c73e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ResourcesData/Prop/룰렛/Model/룰렛.glb (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 20b9877f0f6818b419fc71877220b519
ScriptedImporter:
internalIDToNameTable: []
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Pointer_Red
second: {fileID: 2100000, guid: ebc936fce7f753a4f918824c524fa3d3, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Roulette Base Black
second: {fileID: 2100000, guid: dcb4818cb33532143a7fb252cb0a4a99, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Roulette Wheel
second: {fileID: 2100000, guid: 16da4850ff1532043810de6a076cb1fb, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Roulette Wheel Screen
second: {fileID: 2100000, guid: 8b1daf11de0b3a44ab84113404550392, type: 2}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: cc45016b844e7624dae3aec10fb443ea, type: 3}
reverseAxis: 2
renderPipeline: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 52c585c0af2f2a14e9ed7354f2d76d65
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ResourcesData/Prop/룰렛/Prefab/룰렛.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

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