浏览代码

-Fixed jitter issues

/dots-physics
Mike Geig 5 年前
当前提交
a0278c54
共有 3 个文件被更改,包括 11 次插入9 次删除
  1. 3
      Assets/Unity Physics Items/BuoyantObject_DOTS.cs
  2. 7
      Assets/Unity Physics Items/Physics Scene.unity
  3. 10
      Assets/Unity Physics Items/Systems/UpdateObjectTransformSystem.cs

3
Assets/Unity Physics Items/BuoyantObject_DOTS.cs


if(go.GetComponent<BuoyantObject>()) Destroy(go.GetComponent<BuoyantObject>());
if(go.GetComponent<Engine>()) Destroy(go.GetComponent<Engine>());
if(go.GetComponent<BoatController>()) Destroy(go.GetComponent<BoatController>());
if (go.GetComponent<Rigidbody>()) Destroy(go.GetComponent<Rigidbody>());
if (go.GetComponent<Collider>()) Destroy(go.GetComponent<Collider>());
go.transform.parent = transform.parent;

7
Assets/Unity Physics Items/Physics Scene.unity


objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
propertyPath: m_LocalPosition.x
value: -87.5
value: -100
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
propertyPath: m_LocalPosition.y

propertyPath: m_LocalPosition.z
value: -37.5
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 074aa8ca109924e18baf19f3e26665b6, type: 3}
propertyPath: m_LocalRotation.x

propertyPath: DrawColliders
value: 0
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 4712718218339362870, guid: ebb958ca9e119be438b62f3cce1981fc, type: 3}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ebb958ca9e119be438b62f3cce1981fc, type: 3}
--- !u!1001 &6589000189408555943
PrefabInstance:

10
Assets/Unity Physics Items/Systems/UpdateObjectTransformSystem.cs


using Unity.Physics.Systems;
using Unity.Physics;
//[UpdateBefore(typeof(BuildPhysicsWorld))]
[UpdateAfter(typeof(InputSystem))]
public class UpdateObjectTransformSystem : JobComponentSystem
{
NativeArray<Entity> entities;

{
totalCount = 0;
entities = new NativeArray<Entity>(256, Allocator.Persistent);
positions = new NativeArray<float3>(256, Allocator.Persistent);
rotations = new NativeArray<quaternion>(256, Allocator.Persistent);
entities = new NativeArray<Entity>(512, Allocator.Persistent);
positions = new NativeArray<float3>(512, Allocator.Persistent);
rotations = new NativeArray<quaternion>(512, Allocator.Persistent);
base.OnCreate();
}

protected override JobHandle OnUpdate(JobHandle inputDeps)
{
for (int i = 0; i < SyncJob.count; i++)
for (int i = 0; i < entities.Length; i++)
{
var t = DOTSTransformManager.GetTransform(entities[i]);
if(t != null)

正在加载...
取消
保存