浏览代码
-Added new system of syncing transforms. Currently debugging a crash due to incorrect data access
/dots-physics
-Added new system of syncing transforms. Currently debugging a crash due to incorrect data access
/dots-physics
Mike Geig
5 年前
当前提交
6f444db7
共有 19 个文件被更改,包括 2562 次插入 和 378 次删除
-
2Assets/Unity Physics Items/BoatBodyComponent.cs
-
19Assets/Unity Physics Items/BuoyantObject_DOTS.cs
-
4Assets/Unity Physics Items/Components/BoatDataComponents.cs
-
940Assets/Unity Physics Items/Physics Scene.unity
-
14Assets/Unity Physics Items/Prefabs/BoatEntity.prefab
-
209Assets/Unity Physics Items/Prefabs/DOTS Buoy.prefab
-
89Assets/Unity Physics Items/Systems/ApplyBuoyancyForceSystem.cs
-
59Assets/Unity Physics Items/Systems/GertsnerSystem.cs
-
7Assets/Unity Physics Items/Systems/InputSystem.cs
-
52Assets/Unity Physics Items/DOTSTransformManager.cs
-
11Assets/Unity Physics Items/DOTSTransformManager.cs.meta
-
27Assets/Unity Physics Items/GridSpawner.cs
-
11Assets/Unity Physics Items/GridSpawner.cs.meta
-
386Assets/Unity Physics Items/Prefabs/BoatEntityNew.prefab
-
7Assets/Unity Physics Items/Prefabs/BoatEntityNew.prefab.meta
-
1001Assets/Unity Physics Items/Prefabs/DOTS Buoys.prefab
-
7Assets/Unity Physics Items/Prefabs/DOTS Buoys.prefab.meta
-
84Assets/Unity Physics Items/Systems/UpdateObjectTransformSystem.cs
-
11Assets/Unity Physics Items/Systems/UpdateObjectTransformSystem.cs.meta
940
Assets/Unity Physics Items/Physics Scene.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using Unity.Entities; |
|||
using Unity.Transforms; |
|||
using UnityEngine; |
|||
|
|||
public class DOTSTransformManager : MonoBehaviour |
|||
{ |
|||
static DOTSTransformManager main; |
|||
|
|||
Dictionary<Entity, Transform> objects = new Dictionary<Entity, Transform>(); |
|||
|
|||
|
|||
private void Awake() |
|||
{ |
|||
if (main != null && main != this) |
|||
{ |
|||
Destroy(this); |
|||
return; |
|||
} |
|||
|
|||
main = this; |
|||
} |
|||
|
|||
public static void Register(Entity entity, Transform objTransform) |
|||
{ |
|||
if (main == null || main.objects.ContainsKey(entity)) |
|||
return; |
|||
|
|||
main.objects.Add(entity, objTransform); |
|||
} |
|||
|
|||
public static Transform GetTransform(Entity entity) |
|||
{ |
|||
Transform t = null; |
|||
main.objects.TryGetValue(entity, out t); |
|||
|
|||
return t; |
|||
} |
|||
|
|||
//private void Update()
|
|||
//{
|
|||
// var manager = World.Active.EntityManager;
|
|||
// foreach (var item in objects)
|
|||
// {
|
|||
// var pos = manager.GetComponentData<Translation>(item.Key);
|
|||
// var rot = manager.GetComponentData<Rotation>(item.Key);
|
|||
|
|||
// item.Value.SetPositionAndRotation(pos.Value, rot.Value);
|
|||
// }
|
|||
//}
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4287778bdddd0914f82e916acf501d52 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: -17100 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class GridSpawner : MonoBehaviour |
|||
{ |
|||
public GameObject spawnedObject; |
|||
public float xStep = 3f; |
|||
public float yStep = 8f; |
|||
public int columns = 3; |
|||
public int rows = 3; |
|||
|
|||
private void Start() |
|||
{ |
|||
if (spawnedObject == null) |
|||
return; |
|||
|
|||
for (int x = 0; x < columns; x++) |
|||
{ |
|||
for (int y = 0; y < rows; y++) |
|||
{ |
|||
Vector3 pos = transform.position + new Vector3(xStep * x, 0f, yStep * -y); |
|||
Instantiate(spawnedObject, pos, transform.rotation, transform); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c2b95037c7d02124dabf72d87228cd87 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &5912457028842276017 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 5912457028842276016} |
|||
- component: {fileID: 9074881464304324802} |
|||
- component: {fileID: 9074881464304324805} |
|||
- component: {fileID: 8340553583230086408} |
|||
- component: {fileID: 9074881464304324804} |
|||
- component: {fileID: 9074881464304324807} |
|||
- component: {fileID: 2354741166599181197} |
|||
m_Layer: 11 |
|||
m_Name: BoatEntityNew |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &5912457028842276016 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5912457028842276017} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: -104.12, y: -0.389, z: -3.78} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!114 &9074881464304324802 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5912457028842276017} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: ea7d7495833204790ba1d3a8755397f8, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
ConversionMode: 0 |
|||
--- !u!54 &9074881464304324805 |
|||
Rigidbody: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5912457028842276017} |
|||
serializedVersion: 2 |
|||
m_Mass: 3200 |
|||
m_Drag: 0.1 |
|||
m_AngularDrag: 0.2 |
|||
m_UseGravity: 1 |
|||
m_IsKinematic: 0 |
|||
m_Interpolate: 0 |
|||
m_Constraints: 0 |
|||
m_CollisionDetection: 0 |
|||
--- !u!64 &8340553583230086408 |
|||
MeshCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5912457028842276017} |
|||
m_Material: {fileID: 13400000, guid: bd4c82ff9a8164f5c96a49347c431b99, type: 2} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 1 |
|||
serializedVersion: 3 |
|||
m_Convex: 1 |
|||
m_CookingOptions: 14 |
|||
m_Mesh: {fileID: 2899951614431091848, guid: a362db008c5274e03bf6f3d2387cf617, type: 3} |
|||
--- !u!114 &9074881464304324804 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5912457028842276017} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 0fe52c158d195e64a99e4eaa38bb3df7, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
_buoyancyType: 3 |
|||
density: 483.749 |
|||
volume: 6.6150007 |
|||
voxelResolution: 0.3 |
|||
centerOfMass: {x: 0, y: -0.25, z: -0.55} |
|||
voxels: |
|||
- {x: -0.9000001, y: 0.18077579, z: -2.0381937} |
|||
- {x: -0.9000001, y: 0.18077579, z: -1.7381936} |
|||
- {x: -0.9000001, y: 0.18077579, z: -1.4381937} |
|||
- {x: -0.9000001, y: 0.18077579, z: -1.1381937} |
|||
- {x: -0.9000001, y: 0.18077579, z: -0.83819366} |
|||
- {x: -0.9000001, y: 0.18077579, z: -0.5381937} |
|||
- {x: -0.9000001, y: 0.18077579, z: -0.23819366} |
|||
- {x: -0.9000001, y: 0.18077579, z: 0.06180635} |
|||
- {x: -0.6, y: -0.11922422, z: -1.4381937} |
|||
- {x: -0.6, y: -0.11922422, z: -1.1381937} |
|||
- {x: -0.6, y: -0.11922422, z: -0.83819366} |
|||
- {x: -0.6, y: -0.11922422, z: -0.5381937} |
|||
- {x: -0.6, y: -0.11922422, z: -0.23819366} |
|||
- {x: -0.6, y: -0.11922422, z: 0.06180635} |
|||
- {x: -0.6, y: 0.18077579, z: -2.9381933} |
|||
- {x: -0.6, y: 0.18077579, z: -2.6381934} |
|||
- {x: -0.6, y: 0.18077579, z: -2.3381934} |
|||
- {x: -0.6, y: 0.18077579, z: -2.0381937} |
|||
- {x: -0.6, y: 0.18077579, z: -1.7381936} |
|||
- {x: -0.6, y: 0.18077579, z: -1.4381937} |
|||
- {x: -0.6, y: 0.18077579, z: -1.1381937} |
|||
- {x: -0.6, y: 0.18077579, z: -0.83819366} |
|||
- {x: -0.6, y: 0.18077579, z: -0.5381937} |
|||
- {x: -0.6, y: 0.18077579, z: -0.23819366} |
|||
- {x: -0.6, y: 0.18077579, z: 0.06180635} |
|||
- {x: -0.6, y: 0.18077579, z: 0.3618064} |
|||
- {x: -0.6, y: 0.18077579, z: 0.66180634} |
|||
- {x: -0.6, y: 0.18077579, z: 0.9618064} |
|||
- {x: -0.6, y: 0.18077579, z: 1.2618064} |
|||
- {x: -0.6, y: 0.4807758, z: -2.6381934} |
|||
- {x: -0.6, y: 0.4807758, z: -2.3381934} |
|||
- {x: -0.6, y: 0.4807758, z: -2.0381937} |
|||
- {x: -0.6, y: 0.4807758, z: -1.7381936} |
|||
- {x: -0.6, y: 0.4807758, z: -1.4381937} |
|||
- {x: -0.6, y: 0.4807758, z: -1.1381937} |
|||
- {x: -0.6, y: 0.4807758, z: -0.83819366} |
|||
- {x: -0.6, y: 0.4807758, z: -0.5381937} |
|||
- {x: -0.6, y: 0.4807758, z: -0.23819366} |
|||
- {x: -0.6, y: 0.4807758, z: 0.06180635} |
|||
- {x: -0.6, y: 0.4807758, z: 0.3618064} |
|||
- {x: -0.6, y: 0.4807758, z: 0.66180634} |
|||
- {x: -0.30000004, y: -0.11922422, z: -2.6381934} |
|||
- {x: -0.30000004, y: -0.11922422, z: -2.3381934} |
|||
- {x: -0.30000004, y: -0.11922422, z: -2.0381937} |
|||
- {x: -0.30000004, y: -0.11922422, z: -1.7381936} |
|||
- {x: -0.30000004, y: -0.11922422, z: -1.4381937} |
|||
- {x: -0.30000004, y: -0.11922422, z: -1.1381937} |
|||
- {x: -0.30000004, y: -0.11922422, z: -0.83819366} |
|||
- {x: -0.30000004, y: -0.11922422, z: -0.5381937} |
|||
- {x: -0.30000004, y: -0.11922422, z: -0.23819366} |
|||
- {x: -0.30000004, y: -0.11922422, z: 0.06180635} |
|||
- {x: -0.30000004, y: -0.11922422, z: 0.3618064} |
|||
- {x: -0.30000004, y: -0.11922422, z: 0.66180634} |
|||
- {x: -0.30000004, y: -0.11922422, z: 0.9618064} |
|||
- {x: -0.30000004, y: 0.18077579, z: -2.9381933} |
|||
- {x: -0.30000004, y: 0.18077579, z: -2.6381934} |
|||
- {x: -0.30000004, y: 0.18077579, z: -2.3381934} |
|||
- {x: -0.30000004, y: 0.18077579, z: -2.0381937} |
|||
- {x: -0.30000004, y: 0.18077579, z: -1.7381936} |
|||
- {x: -0.30000004, y: 0.18077579, z: -1.4381937} |
|||
- {x: -0.30000004, y: 0.18077579, z: -1.1381937} |
|||
- {x: -0.30000004, y: 0.18077579, z: -0.83819366} |
|||
- {x: -0.30000004, y: 0.18077579, z: -0.5381937} |
|||
- {x: -0.30000004, y: 0.18077579, z: -0.23819366} |
|||
- {x: -0.30000004, y: 0.18077579, z: 0.06180635} |
|||
- {x: -0.30000004, y: 0.18077579, z: 0.3618064} |
|||
- {x: -0.30000004, y: 0.18077579, z: 0.66180634} |
|||
- {x: -0.30000004, y: 0.18077579, z: 0.9618064} |
|||
- {x: -0.30000004, y: 0.18077579, z: 1.2618064} |
|||
- {x: -0.30000004, y: 0.18077579, z: 1.5618063} |
|||
- {x: -0.30000004, y: 0.18077579, z: 1.8618064} |
|||
- {x: -0.30000004, y: 0.4807758, z: -2.9381933} |
|||
- {x: -0.30000004, y: 0.4807758, z: -2.6381934} |
|||
- {x: -0.30000004, y: 0.4807758, z: -2.3381934} |
|||
- {x: -0.30000004, y: 0.4807758, z: -2.0381937} |
|||
- {x: -0.30000004, y: 0.4807758, z: -1.7381936} |
|||
- {x: -0.30000004, y: 0.4807758, z: -1.4381937} |
|||
- {x: -0.30000004, y: 0.4807758, z: -1.1381937} |
|||
- {x: -0.30000004, y: 0.4807758, z: -0.83819366} |
|||
- {x: -0.30000004, y: 0.4807758, z: -0.5381937} |
|||
- {x: -0.30000004, y: 0.4807758, z: -0.23819366} |
|||
- {x: -0.30000004, y: 0.4807758, z: 0.06180635} |
|||
- {x: -0.30000004, y: 0.4807758, z: 0.3618064} |
|||
- {x: -0.30000004, y: 0.4807758, z: 0.66180634} |
|||
- {x: -0.30000004, y: 0.4807758, z: 0.9618064} |
|||
- {x: -0.30000004, y: 0.4807758, z: 1.2618064} |
|||
- {x: -0.30000004, y: 0.4807758, z: 1.5618063} |
|||
- {x: -0.30000004, y: 0.7807758, z: -2.3381934} |
|||
- {x: -0.30000004, y: 0.7807758, z: -2.0381937} |
|||
- {x: -0.30000004, y: 0.7807758, z: -1.7381936} |
|||
- {x: -0.30000004, y: 0.7807758, z: -1.4381937} |
|||
- {x: -0.30000004, y: 0.7807758, z: -1.1381937} |
|||
- {x: -0.30000004, y: 0.7807758, z: -0.83819366} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -2.9381933} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -2.6381934} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -2.3381934} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -2.0381937} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -1.7381936} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -1.4381937} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -1.1381937} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -0.83819366} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -0.5381937} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: -0.23819366} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: 0.06180635} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: 0.3618064} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: 0.66180634} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: 0.9618064} |
|||
- {x: -0.000000029802322, y: -0.11922422, z: 1.2618064} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -2.9381933} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -2.6381934} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -2.3381934} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -2.0381937} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -1.7381936} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -1.4381937} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -1.1381937} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -0.83819366} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -0.5381937} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: -0.23819366} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: 0.06180635} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: 0.3618064} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: 0.66180634} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: 0.9618064} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: 1.2618064} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: 1.5618063} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: 1.8618064} |
|||
- {x: -0.000000029802322, y: 0.18077579, z: 2.1618063} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -2.9381933} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -2.6381934} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -2.3381934} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -2.0381937} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -1.7381936} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -1.4381937} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -1.1381937} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -0.83819366} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -0.5381937} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: -0.23819366} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: 0.06180635} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: 0.3618064} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: 0.66180634} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: 0.9618064} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: 1.2618064} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: 1.5618063} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: 1.8618064} |
|||
- {x: -0.000000029802322, y: 0.4807758, z: 2.1618063} |
|||
- {x: -0.000000029802322, y: 0.7807758, z: -2.3381934} |
|||
- {x: -0.000000029802322, y: 0.7807758, z: -2.0381937} |
|||
- {x: -0.000000029802322, y: 0.7807758, z: -1.7381936} |
|||
- {x: -0.000000029802322, y: 0.7807758, z: -1.4381937} |
|||
- {x: -0.000000029802322, y: 0.7807758, z: -1.1381937} |
|||
- {x: -0.000000029802322, y: 0.7807758, z: -0.83819366} |
|||
- {x: -0.000000029802322, y: 0.7807758, z: -0.5381937} |
|||
- {x: -0.000000029802322, y: 0.7807758, z: -0.23819366} |
|||
- {x: 0.29999998, y: -0.11922422, z: -2.6381934} |
|||
- {x: 0.29999998, y: -0.11922422, z: -2.3381934} |
|||
- {x: 0.29999998, y: -0.11922422, z: -2.0381937} |
|||
- {x: 0.29999998, y: -0.11922422, z: -1.7381936} |
|||
- {x: 0.29999998, y: -0.11922422, z: -1.4381937} |
|||
- {x: 0.29999998, y: -0.11922422, z: -1.1381937} |
|||
- {x: 0.29999998, y: -0.11922422, z: -0.83819366} |
|||
- {x: 0.29999998, y: -0.11922422, z: -0.5381937} |
|||
- {x: 0.29999998, y: -0.11922422, z: -0.23819366} |
|||
- {x: 0.29999998, y: -0.11922422, z: 0.06180635} |
|||
- {x: 0.29999998, y: -0.11922422, z: 0.3618064} |
|||
- {x: 0.29999998, y: -0.11922422, z: 0.66180634} |
|||
- {x: 0.29999998, y: -0.11922422, z: 0.9618064} |
|||
- {x: 0.29999998, y: 0.18077579, z: -2.9381933} |
|||
- {x: 0.29999998, y: 0.18077579, z: -2.6381934} |
|||
- {x: 0.29999998, y: 0.18077579, z: -2.3381934} |
|||
- {x: 0.29999998, y: 0.18077579, z: -2.0381937} |
|||
- {x: 0.29999998, y: 0.18077579, z: -1.7381936} |
|||
- {x: 0.29999998, y: 0.18077579, z: -1.4381937} |
|||
- {x: 0.29999998, y: 0.18077579, z: -1.1381937} |
|||
- {x: 0.29999998, y: 0.18077579, z: -0.83819366} |
|||
- {x: 0.29999998, y: 0.18077579, z: -0.5381937} |
|||
- {x: 0.29999998, y: 0.18077579, z: -0.23819366} |
|||
- {x: 0.29999998, y: 0.18077579, z: 0.06180635} |
|||
- {x: 0.29999998, y: 0.18077579, z: 0.3618064} |
|||
- {x: 0.29999998, y: 0.18077579, z: 0.66180634} |
|||
- {x: 0.29999998, y: 0.18077579, z: 0.9618064} |
|||
- {x: 0.29999998, y: 0.18077579, z: 1.2618064} |
|||
- {x: 0.29999998, y: 0.18077579, z: 1.5618063} |
|||
- {x: 0.29999998, y: 0.18077579, z: 1.8618064} |
|||
- {x: 0.29999998, y: 0.4807758, z: -2.9381933} |
|||
- {x: 0.29999998, y: 0.4807758, z: -2.6381934} |
|||
- {x: 0.29999998, y: 0.4807758, z: -2.3381934} |
|||
- {x: 0.29999998, y: 0.4807758, z: -2.0381937} |
|||
- {x: 0.29999998, y: 0.4807758, z: -1.7381936} |
|||
- {x: 0.29999998, y: 0.4807758, z: -1.4381937} |
|||
- {x: 0.29999998, y: 0.4807758, z: -1.1381937} |
|||
- {x: 0.29999998, y: 0.4807758, z: -0.83819366} |
|||
- {x: 0.29999998, y: 0.4807758, z: -0.5381937} |
|||
- {x: 0.29999998, y: 0.4807758, z: -0.23819366} |
|||
- {x: 0.29999998, y: 0.4807758, z: 0.06180635} |
|||
- {x: 0.29999998, y: 0.4807758, z: 0.3618064} |
|||
- {x: 0.29999998, y: 0.4807758, z: 0.66180634} |
|||
- {x: 0.29999998, y: 0.4807758, z: 0.9618064} |
|||
- {x: 0.29999998, y: 0.4807758, z: 1.2618064} |
|||
- {x: 0.29999998, y: 0.4807758, z: 1.5618063} |
|||
- {x: 0.29999998, y: 0.7807758, z: -2.3381934} |
|||
- {x: 0.29999998, y: 0.7807758, z: -2.0381937} |
|||
- {x: 0.29999998, y: 0.7807758, z: -1.7381936} |
|||
- {x: 0.29999998, y: 0.7807758, z: -1.4381937} |
|||
- {x: 0.29999998, y: 0.7807758, z: -1.1381937} |
|||
- {x: 0.29999998, y: 0.7807758, z: -0.83819366} |
|||
- {x: 0.6, y: -0.11922422, z: -1.4381937} |
|||
- {x: 0.6, y: -0.11922422, z: -1.1381937} |
|||
- {x: 0.6, y: -0.11922422, z: -0.83819366} |
|||
- {x: 0.6, y: -0.11922422, z: -0.5381937} |
|||
- {x: 0.6, y: -0.11922422, z: -0.23819366} |
|||
- {x: 0.6, y: -0.11922422, z: 0.06180635} |
|||
- {x: 0.6, y: 0.18077579, z: -2.9381933} |
|||
- {x: 0.6, y: 0.18077579, z: -2.6381934} |
|||
- {x: 0.6, y: 0.18077579, z: -2.3381934} |
|||
- {x: 0.6, y: 0.18077579, z: -2.0381937} |
|||
- {x: 0.6, y: 0.18077579, z: -1.7381936} |
|||
- {x: 0.6, y: 0.18077579, z: -1.4381937} |
|||
- {x: 0.6, y: 0.18077579, z: -1.1381937} |
|||
- {x: 0.6, y: 0.18077579, z: -0.83819366} |
|||
- {x: 0.6, y: 0.18077579, z: -0.5381937} |
|||
- {x: 0.6, y: 0.18077579, z: -0.23819366} |
|||
- {x: 0.6, y: 0.18077579, z: 0.06180635} |
|||
- {x: 0.6, y: 0.18077579, z: 0.3618064} |
|||
- {x: 0.6, y: 0.18077579, z: 0.66180634} |
|||
- {x: 0.6, y: 0.18077579, z: 0.9618064} |
|||
- {x: 0.6, y: 0.18077579, z: 1.2618064} |
|||
- {x: 0.6, y: 0.4807758, z: -2.6381934} |
|||
- {x: 0.6, y: 0.4807758, z: -2.3381934} |
|||
- {x: 0.6, y: 0.4807758, z: -2.0381937} |
|||
- {x: 0.6, y: 0.4807758, z: -1.7381936} |
|||
- {x: 0.6, y: 0.4807758, z: -1.4381937} |
|||
- {x: 0.6, y: 0.4807758, z: -1.1381937} |
|||
- {x: 0.6, y: 0.4807758, z: -0.83819366} |
|||
- {x: 0.6, y: 0.4807758, z: -0.5381937} |
|||
- {x: 0.6, y: 0.4807758, z: -0.23819366} |
|||
- {x: 0.6, y: 0.4807758, z: 0.06180635} |
|||
- {x: 0.6, y: 0.4807758, z: 0.3618064} |
|||
- {x: 0.6, y: 0.4807758, z: 0.66180634} |
|||
- {x: 0.9, y: 0.18077579, z: -2.0381937} |
|||
- {x: 0.9, y: 0.18077579, z: -1.7381936} |
|||
- {x: 0.9, y: 0.18077579, z: -1.4381937} |
|||
- {x: 0.9, y: 0.18077579, z: -1.1381937} |
|||
- {x: 0.9, y: 0.18077579, z: -0.83819366} |
|||
- {x: 0.9, y: 0.18077579, z: -0.5381937} |
|||
- {x: 0.9, y: 0.18077579, z: -0.23819366} |
|||
- {x: 0.9, y: 0.18077579, z: 0.06180635} |
|||
colliders: |
|||
- {fileID: 8340553583230086408} |
|||
percentSubmerged: 0 |
|||
childObject: {fileID: 1553288845585282, guid: fc3ffb83d6eafb1489a5b23bc82d25b6, |
|||
type: 3} |
|||
--- !u!114 &9074881464304324807 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5912457028842276017} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 01c46922a8ed04b0081de10e51b3762f, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
RB: {fileID: 9074881464304324805} |
|||
vel: {x: 0, y: 0, z: 0} |
|||
engineSound: {fileID: 0} |
|||
waterSound: {fileID: 0} |
|||
steeringTorque: 5 |
|||
upwardTorque: 3 |
|||
horsePower: 18 |
|||
enginePosition: {x: 0, y: 0.05, z: -3.31} |
|||
--- !u!114 &2354741166599181197 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 5912457028842276017} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 8e14db15b85a74d2288a792b27ee0fa6, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
Human: 0 |
|||
RandomizeColors: 1 |
|||
boatRenderer: {fileID: 0} |
|||
engine: {fileID: 9074881464304324807} |
|||
cam: {fileID: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: ef588ca3a301a7c4b9fca4bdf9c1c390 |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
Assets/Unity Physics Items/Prefabs/DOTS Buoys.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 151b573bdeb429d45b0de257872d3e54 |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using Unity.Burst; |
|||
using Unity.Collections; |
|||
using Unity.Entities; |
|||
using Unity.Jobs; |
|||
using Unity.Mathematics; |
|||
using Unity.Transforms; |
|||
using UnityEngine; |
|||
using static WaterSystem.BuoyantObject_DOTS; |
|||
using Unity.Physics.Extensions; |
|||
using Unity.Physics.Systems; |
|||
using Unity.Physics; |
|||
|
|||
//[UpdateBefore(typeof(BuildPhysicsWorld))]
|
|||
public class UpdateObjectTransformSystem : JobComponentSystem |
|||
{ |
|||
NativeArray<Entity> entities; |
|||
NativeArray<float3> positions; |
|||
NativeArray<quaternion> rotations; |
|||
|
|||
int totalCount; |
|||
|
|||
protected override void OnCreate() |
|||
{ |
|||
totalCount = 0; |
|||
|
|||
entities = new NativeArray<Entity>(256, Allocator.Persistent); |
|||
positions = new NativeArray<float3>(256, Allocator.Persistent); |
|||
rotations = new NativeArray<quaternion>(256, Allocator.Persistent); |
|||
|
|||
base.OnCreate(); |
|||
} |
|||
|
|||
protected override void OnDestroy() |
|||
{ |
|||
entities.Dispose(); |
|||
positions.Dispose(); |
|||
rotations.Dispose(); |
|||
|
|||
base.OnDestroy(); |
|||
} |
|||
|
|||
protected override JobHandle OnUpdate(JobHandle inputDeps) |
|||
{ |
|||
for (int i = 0; i < SyncJob.count; i++) |
|||
{ |
|||
var t = DOTSTransformManager.GetTransform(entities[i]); |
|||
if(t != null) |
|||
t.SetPositionAndRotation(positions[i], rotations[i]); |
|||
} |
|||
|
|||
SyncJob.count = 0; |
|||
|
|||
var job = new SyncJob |
|||
{ |
|||
entities = entities, |
|||
positions = positions, |
|||
rotations = rotations |
|||
}; |
|||
|
|||
return job.Schedule(this, inputDeps); |
|||
} |
|||
|
|||
//[BurstCompile]
|
|||
[RequireComponentTag(typeof(SyncTransformTag))] |
|||
public struct SyncJob : IJobForEachWithEntity<Translation, Rotation> |
|||
{ |
|||
public NativeArray<Entity> entities; |
|||
public NativeArray<float3> positions; |
|||
public NativeArray<quaternion> rotations; |
|||
|
|||
public static int count; |
|||
|
|||
public void Execute(Entity entity, int index, ref Translation pos, ref Rotation rot) |
|||
{ |
|||
count++; |
|||
|
|||
entities[index] = entity; |
|||
positions[index] = pos.Value; |
|||
rotations[index] = rot.Value; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: dcec19ed80b4bb4469466c23723b84a4 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue