コード例 #1
0
ファイル: Explosion.cs プロジェクト: yonder/CryMono
        public void Explode()
        {
            if (explosion.rmax == 0)
            {
                explosion.rmax = 0.0001f;
            }
            explosion.nOccRes = explosion.rmax > 50 ? 0 : 16;

            affectedEnts = NativePhysicsMethods.SimulateExplosion(explosion);
        }
コード例 #2
0
ファイル: EntityBase.cs プロジェクト: yonder/CryMono
        public void Physicalize(PhysicalizationParams physicalizationParams)
        {
            NativePhysicsMethods.Physicalize(this.GetIEntity(), physicalizationParams);

            if (physicalizationParams.type == PhysicalizationType.None)
            {
                _physics = null;
            }
            else
            {
                _physics = PhysicalEntity.TryGet(NativePhysicsMethods.GetPhysicalEntity(EntityHandle));
            }
        }
コード例 #3
0
ファイル: PhysicalEntity.cs プロジェクト: yonder/CryMono
        public bool AddImpulse(Vec3 vImpulse, Vec3?angImpulse = null, Vec3?point = null)
        {
            var impulse = PhysicalEntityImpulseAction.Create();

            impulse.impulse = vImpulse;

            if (angImpulse != null)
            {
                impulse.angImpulse = angImpulse.Value;
            }
            if (point != null)
            {
                impulse.point = point.Value;
            }

            return(NativePhysicsMethods.ActionImpulse(Handle, ref impulse));
        }
コード例 #4
0
        public void AddImpulse(Vec3 vImpulse, Vec3?angImpulse = null, Vec3?point = null)
        {
            var impulse = pe_action_impulse.Create();

            impulse.impulse = vImpulse;

            if (angImpulse != null)
            {
                impulse.angImpulse = angImpulse.Value;
            }
            if (point != null)
            {
                impulse.point = point.Value;
            }

            NativePhysicsMethods.AddImpulse(Owner.GetIEntity(), impulse);
        }
コード例 #5
0
ファイル: PhysicalEntity.cs プロジェクト: yonder/CryMono
        internal static PhysicalEntity TryGet(IntPtr IPhysicalEntityHandle)
        {
#if !(RELEASE && RELEASE_DISABLE_CHECKS)
            if (IPhysicalEntityHandle == IntPtr.Zero)
            {
                throw new NullPointerException();
            }
#endif

            var physicalEntity = PhysicalEntities.FirstOrDefault(x => x.Handle == IPhysicalEntityHandle);
            if (physicalEntity == null)
            {
                switch (NativePhysicsMethods.GetPhysicalEntityType(IPhysicalEntityHandle))
                {
                case PhysicalizationType.Static:
                case PhysicalizationType.Rigid:
                case PhysicalizationType.WheeledVehicle:
                case PhysicalizationType.Articulated:
                case PhysicalizationType.Soft:
                case PhysicalizationType.Rope:
                    physicalEntity = new PhysicalEntity(IPhysicalEntityHandle);
                    break;

                case PhysicalizationType.Living:
                    physicalEntity = new PhysicalEntityLiving(IPhysicalEntityHandle);
                    break;

                case PhysicalizationType.Particle:
                    physicalEntity = new PhysicalEntityParticle(IPhysicalEntityHandle);
                    break;

                case PhysicalizationType.Area:
                    physicalEntity = new PhysicalEntityArea(IPhysicalEntityHandle);
                    break;
                }

                if (physicalEntity != null)
                {
                    PhysicalEntities.Add(physicalEntity);
                }
            }

            return(physicalEntity);
        }
コード例 #6
0
 public bool GetParameters(ref ParticleParameters parameters)
 {
     return(NativePhysicsMethods.GetParticleParams(Handle, ref parameters));
 }
コード例 #7
0
 /// <summary>
 /// Save the current physics settings.
 /// </summary>
 public void Save()
 {
     NativePhysicsMethods.Physicalize(Owner.GetIEntity(), _params);
 }
コード例 #8
0
 internal PhysicalEntity(EntityBase _entity)
     : this()
 {
     owner  = _entity;
     Handle = NativePhysicsMethods.GetPhysicalEntity(Owner.GetIEntity());
 }
コード例 #9
0
ファイル: PhysicalEntity.cs プロジェクト: yonder/CryMono
 public bool SetSimulationParameters(ref PhysicalSimulationParameters flags)
 {
     return(NativePhysicsMethods.SetSimulationParams(Handle, ref flags));
 }
コード例 #10
0
ファイル: PhysicalEntity.cs プロジェクト: yonder/CryMono
 public bool SetFlags(ref PhysicalFlagsParameters flags)
 {
     return(NativePhysicsMethods.SetFlagParams(Handle, ref flags));
 }