forked from cgvr/DeltaVR
add TrellisClient, use it for model generation
This commit is contained in:
@@ -5,7 +5,6 @@ using FishNet.Object.Synchronizing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TMPro;
|
||||
using Unity.XR.CoreUtils;
|
||||
using UnityEngine;
|
||||
@@ -123,7 +122,7 @@ public class ArcheryRange : NetworkBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
async private void SpawnTarget()
|
||||
private void SpawnTarget()
|
||||
{
|
||||
if (!IsServer) return;
|
||||
|
||||
@@ -133,23 +132,21 @@ public class ArcheryRange : NetworkBehaviour
|
||||
Random.Range(minRandomOffset.z, maxRandomOffset.z)
|
||||
);
|
||||
|
||||
var target = await SpawnTarget(randomPos);
|
||||
var target = SpawnTarget(randomPos);
|
||||
_targets.Add(target);
|
||||
}
|
||||
|
||||
async private Task<ArcheryTarget> SpawnTarget(Vector3 randomPos)
|
||||
private ArcheryTarget SpawnTarget(Vector3 randomPos)
|
||||
{
|
||||
GameObject targetObject;
|
||||
if (modelGenerationBox.LastModelPath == null)
|
||||
if (modelGenerationBox.GeneratedModel == null)
|
||||
{
|
||||
// spawn default UFO
|
||||
targetObject = Instantiate(targetPrefab, randomPos, Quaternion.identity, null);
|
||||
} else
|
||||
{
|
||||
// spawn generated model
|
||||
targetObject = await PipelineManager.Instance.SpawnModel(modelGenerationBox.LastModelPath);
|
||||
targetObject.transform.position = randomPos;
|
||||
targetObject.transform.rotation = Quaternion.identity;
|
||||
targetObject = Instantiate(modelGenerationBox.GeneratedModel, randomPos, Quaternion.identity, null);
|
||||
InitializeArcherytargetObject(targetObject);
|
||||
}
|
||||
|
||||
@@ -165,7 +162,7 @@ public class ArcheryRange : NetworkBehaviour
|
||||
ArcheryTarget archeryTarget = targetObject.AddComponent<ArcheryTarget>();
|
||||
archeryTarget.pointsText = archeryTargetPointsText;
|
||||
|
||||
Rigidbody rigidbody = targetObject.AddComponent<Rigidbody>();
|
||||
Rigidbody rigidbody = targetObject.GetComponent<Rigidbody>();
|
||||
rigidbody.useGravity = false;
|
||||
rigidbody.isKinematic = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user