public void AddSphereDynamicCollider(SphereDynamicColliderStats _sphereDynamicColliderStats, GameObject _sphereDynamicColliderprefab, EntityManager _entityManager) { Entity _sphereCollider = GameObjectConversionUtility.ConvertGameObjectHierarchy(_sphereDynamicColliderprefab, new GameObjectConversionSettings() { DestinationWorld = World.DefaultGameObjectInjectionWorld }); BlobAssetReference <Collider> sourceCollider = _entityManager.GetComponentData <PhysicsCollider>(_sphereCollider).Value; _entityManager.AddComponentData(_sphereDynamicColliderStats._entity, new Translation { Value = _sphereDynamicColliderStats._position }); _entityManager.AddComponentData(_sphereDynamicColliderStats._entity, new Rotation { Value = _sphereDynamicColliderStats._orientation }); _entityManager.AddComponentData(_sphereDynamicColliderStats._entity, new PhysicsCollider { Value = sourceCollider }); _entityManager.AddComponentData(_sphereDynamicColliderStats._entity, new PhysicsDamping() { Linear = _sphereDynamicColliderStats.linearDamping, Angular = _sphereDynamicColliderStats.angularDamping }); _entityManager.AddComponentData(_sphereDynamicColliderStats._entity, new PhysicsVelocity() { Linear = _sphereDynamicColliderStats.linearVelocity, Angular = _sphereDynamicColliderStats.angularVelocity }); _entityManager.SetComponentData(_sphereDynamicColliderStats._entity, new PhysicsMass() { Transform = _sphereDynamicColliderStats.massTransform, InverseMass = _sphereDynamicColliderStats.inverseMass, InverseInertia = _sphereDynamicColliderStats.inverseInertiaMass, AngularExpansionFactor = _sphereDynamicColliderStats.angularExpansionFactorMass }); }
public void AddSphereCollider(SphereDynamicColliderStats _sphereColliderStats, GameObject _sphereColliderprefab, EntityManager _entityManager) { Entity _sphereCollider = GameObjectConversionUtility.ConvertGameObjectHierarchy(_sphereColliderprefab, new GameObjectConversionSettings() { DestinationWorld = World.DefaultGameObjectInjectionWorld }); BlobAssetReference <Collider> sourceCollider = _entityManager.GetComponentData <PhysicsCollider>(_sphereCollider).Value; _entityManager.AddComponentData(_sphereColliderStats._entity, new Translation { Value = _sphereColliderStats._position }); _entityManager.AddComponentData(_sphereColliderStats._entity, new Rotation { Value = _sphereColliderStats._orientation }); _entityManager.AddComponentData(_sphereColliderStats._entity, new PhysicsCollider { Value = sourceCollider }); }