Browse Source

[新增]定位原点

develop
yuhonglei 12 months ago
parent
commit
edc492738b
  1. BIN
      Assets/AddressableAssetsData/WebGL/addressables_content_state.bin
  2. 45
      Assets/Common/UIViews/PersonnelLocationPanel.prefab
  3. BIN
      Assets/LongZhiMeng/LocationPivot.fbx
  4. 97
      Assets/LongZhiMeng/LocationPivot.fbx.meta
  5. 78
      Assets/LongZhiMeng/New Material.mat
  6. 8
      Assets/LongZhiMeng/New Material.mat.meta
  7. 96
      Assets/LongZhiMeng/Plane.prefab
  8. 7
      Assets/LongZhiMeng/Plane.prefab.meta
  9. BIN
      Assets/LongZhiMeng/微信图片_20240418103124.jpg
  10. 92
      Assets/LongZhiMeng/微信图片_20240418103124.jpg.meta
  11. 6
      Assets/Scenes/MainScene.unity
  12. BIN
      Assets/Scenes/MainScene/NavMesh.asset
  13. 8
      Assets/Scenes/MainScene/NavMesh.asset.meta
  14. 35
      Assets/Scripts/EmployeeScrollView.cs
  15. 43
      Assets/Scripts/Main/Core/PersonnelLocation/LocationSimulator.cs

BIN
Assets/AddressableAssetsData/WebGL/addressables_content_state.bin

Binary file not shown.

45
Assets/Common/UIViews/PersonnelLocationPanel.prefab

@ -427,7 +427,8 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
itemTemplate: {fileID: 0}
itemTemplate: {fileID: 1788210760186998581}
itemHeight: 50
--- !u!1 &1674835338659540955
GameObject:
m_ObjectHideFlags: 0
@ -790,8 +791,7 @@ GameObject:
m_Component:
- component: {fileID: 5897541069319522633}
- component: {fileID: 8413078406590609898}
- component: {fileID: 3720833862665627152}
- component: {fileID: 9183620373622822547}
- component: {fileID: 3960836345806944122}
m_Layer: 5
m_Name: Content
m_TagString: Untagged
@ -831,7 +831,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_AllowSwitchOff: 1
--- !u!114 &3720833862665627152
--- !u!114 &3960836345806944122
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -849,27 +849,13 @@ MonoBehaviour:
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 10
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
--- !u!114 &9183620373622822547
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3160483726207073599}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!1 &3495462249791581131
GameObject:
m_ObjectHideFlags: 0
@ -2660,12 +2646,6 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8a7f35ec8e38d16469abba24b7d88a24, type: 3}
--- !u!1 &6336015375688237220 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5587035623055505194, guid: 8a7f35ec8e38d16469abba24b7d88a24,
type: 3}
m_PrefabInstance: {fileID: 1902541208461424526}
m_PrefabAsset: {fileID: 0}
--- !u!224 &179092984280692916 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 1737099973456170810, guid: 8a7f35ec8e38d16469abba24b7d88a24,
@ -2684,6 +2664,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &6336015375688237220 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5587035623055505194, guid: 8a7f35ec8e38d16469abba24b7d88a24,
type: 3}
m_PrefabInstance: {fileID: 1902541208461424526}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2743875761984857735
PrefabInstance:
m_ObjectHideFlags: 0
@ -3524,12 +3510,17 @@ PrefabInstance:
- target: {fileID: 3709271830102431828, guid: a3c05a63b89cee44294ee69c283ebaa2,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.000060677903
value: 0.00012287228
objectReference: {fileID: 0}
- target: {fileID: 3709271830637054745, guid: a3c05a63b89cee44294ee69c283ebaa2,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3709271830637054747, guid: a3c05a63b89cee44294ee69c283ebaa2,
type: 3}
propertyPath: m_Size
value: 1
value: 0.99837893
objectReference: {fileID: 0}
- target: {fileID: 3709271830637054747, guid: a3c05a63b89cee44294ee69c283ebaa2,
type: 3}

BIN
Assets/LongZhiMeng/LocationPivot.fbx

Binary file not shown.

97
Assets/LongZhiMeng/LocationPivot.fbx.meta

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: a4e7020e0586a674394242237d1bdd4d
ModelImporter:
serializedVersion: 19301
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
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
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
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
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

78
Assets/LongZhiMeng/New Material.mat

@ -0,0 +1,78 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Material
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
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}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 75f251dce8525154da22a5ea0a5caff0, type: 3}
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}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 0.44705883}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

8
Assets/LongZhiMeng/New Material.mat.meta

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

96
Assets/LongZhiMeng/Plane.prefab

@ -0,0 +1,96 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8734664957166163085
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6853199470588153422}
- component: {fileID: 1450647692940117777}
- component: {fileID: 852470998154511825}
- component: {fileID: 3101253239328018460}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6853199470588153422
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8734664957166163085}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.48, y: -17.2, z: 40.66}
m_LocalScale: {x: 7.38, y: 0.62043846, z: 5.1045003}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &1450647692940117777
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8734664957166163085}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &852470998154511825
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8734664957166163085}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 219f223dc96cc934dbdfac3b0196e899, 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
--- !u!64 &3101253239328018460
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8734664957166163085}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}

7
Assets/LongZhiMeng/Plane.prefab.meta

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

BIN
Assets/LongZhiMeng/微信图片_20240418103124.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

92
Assets/LongZhiMeng/微信图片_20240418103124.jpg.meta

@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: 75f251dce8525154da22a5ea0a5caff0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 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
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

6
Assets/Scenes/MainScene.unity

@ -107,7 +107,7 @@ NavMeshSettings:
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentRadius: 0.2
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
@ -115,13 +115,13 @@ NavMeshSettings:
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
cellSize: 0.06666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
m_NavMeshData: {fileID: 23800000, guid: 51d08a1bad3082149bcedaf217639a46, type: 2}
--- !u!1001 &389328810
PrefabInstance:
m_ObjectHideFlags: 0

BIN
Assets/Scenes/MainScene/NavMesh.asset

Binary file not shown.

8
Assets/Scenes/MainScene/NavMesh.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 51d08a1bad3082149bcedaf217639a46
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 23800000
userData:
assetBundleName:
assetBundleVariant:

35
Assets/Scripts/EmployeeScrollView.cs

@ -2,17 +2,18 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
#endif
[RequireComponent(typeof(RectTransform))]
[DisallowMultipleComponent]
public class EmployeeScrollView : ScrollRect
{
[SerializeField]
public RectTransform itemTemplate;
public float itemHeight =30f;
public void SetUpdateFunc<T>(List<T> list,Action<int ,GameObject> action)
{
if(itemTemplate == null)
itemTemplate = transform.Find("Item").GetComponent<RectTransform>();
ClearData();
int i = 0;
foreach (var item in list)
@ -22,6 +23,16 @@ public class EmployeeScrollView : ScrollRect
action?.Invoke(i,go);
i++;
}
UpdateContentSize(list.Count);
}
private void UpdateContentSize(int itemCount)
{
Vector2 size = content.sizeDelta;
size.y = itemCount * itemHeight;
content.sizeDelta = size;
LayoutRebuilder.ForceRebuildLayoutImmediate(content);
}
private void ClearData()
@ -32,3 +43,21 @@ public class EmployeeScrollView : ScrollRect
}
}
}
# if UNITY_EDITOR
[CustomEditor(typeof(EmployeeScrollView))]
public class EmployeeScrollViewEditor : Editor
{
public override void OnInspectorGUI()
{
// 绘制默认Inspector
base.OnInspectorGUI();
if (GUI.changed)
{
EditorUtility.SetDirty(target);
}
}
}
#endif

43
Assets/Scripts/Main/Core/PersonnelLocation/LocationSimulator.cs

@ -9,18 +9,25 @@ public class LocationSimulator : MonoBehaviour
//定位人员
private Dictionary<long, AgentController> agentControllers = new Dictionary<long, AgentController>();
//历史数据
public List<PositionData> historyData = new List<PositionData>();
private List<PositionData> historyData = new List<PositionData>();
//是否保存历史数据
[HideInInspector]
public bool isSaveHistory;
//轨迹回放人员
private GameObject trackAgent;
//轨迹回放数据
public List<LocationData> trackLocationData;
private List<LocationData> trackLocationData;
//轨迹回放Coroutines
private List<Coroutine> trackCoroutines = new List<Coroutine>();
public LayerMask layerMask = -1;
//public LayerMask layerMask = -1;
private int characterCount = 0;
public float offsetX = 5.534961f;
public float offsetZ = 40.70064f;
/// <summary>
/// 开启定位
/// </summary>
@ -247,16 +254,16 @@ public class LocationSimulator : MonoBehaviour
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public float SetY(Vector3 position)
{
RaycastHit hit;
if (Physics.Raycast(position, Vector3.down, out hit, Mathf.Infinity, layerMask))
{
// 如果射线击中地面,设置Y轴为地面高度
return hit.point.y;
}
return 0f;
}
//public float SetY(Vector3 position)
//{
// RaycastHit hit;
// if (Physics.Raycast(position, Vector3.down, out hit, Mathf.Infinity, layerMask))
// {
// // 如果射线击中地面,设置Y轴为地面高度
// return hit.point.y;
// }
// return 0f;
//}
/// <summary>
/// 创建agent对象
@ -305,14 +312,8 @@ public class LocationSimulator : MonoBehaviour
/// <returns></returns>
public Vector3 ConversionTransform(LocationData data)
{
var y = 0f;
if(data.stations.Contains("1020"))
y = -0.5f;
else
y = 0.5f;
var pos = new Vector3(-(float)data.xAxis, y, -(float)data.yAxis/1.057f);
pos.y = SetY(pos);
var pos = new Vector3(-((float)data.xAxis+offsetX), -17.7f, -((float)data.yAxis+offsetZ));
//pos.y = SetY(pos);
return pos;
}

Loading…
Cancel
Save