Ejemplo n.º 1
0
        public void Explode()
        {
            if (Math.Abs(this.explosion.rmax) < 0.0001f)
            {
                explosion.rmax = 0.0001f;
            }
            explosion.nOccRes = explosion.rmax > 50 ? 0 : 16;

            affectedEnts = PhysicsInterop.SimulateExplosion(explosion);
        }
Ejemplo n.º 2
0
        public override void Init(AntInterop interop)
        {
            _interop     = interop;
            _recognition = interop.GetProperty <RecognitionInterop>();
            _physics     = interop.GetProperty <PhysicsInterop>();
            _interaction = interop.GetProperty <InteractionInterop>();

            _physics.OnWaits        += interop_Waits;
            _interop.Tick           += interop_Tick;
            _recognition.Spots      += interop_Spots;
            _physics.OnCollision    += interop_Collided;
            _recognition.Smells     += interop_Smells;
            _physics.OnTargetReched += interop_Reached;
        }
Ejemplo n.º 3
0
        public override void Init(AntInterop interop)
        {
            _interop = interop;
            _recognition = interop.GetProperty<RecognitionInterop>();
            _physics = interop.GetProperty<PhysicsInterop>();
            _interaction = interop.GetProperty<InteractionInterop>();

            _physics.OnWaits += interop_Waits;
            _interop.Tick += interop_Tick;
            _recognition.Spots += interop_Spots;
            _physics.OnCollision += interop_Collided;
            _recognition.Smells += interop_Smells;
            _physics.OnTargetReched += interop_Reached;
        }
Ejemplo n.º 4
0
        public bool AddImpulse(Vector3 vImpulse, Vector3?angImpulse = null, Vector3?point = null)
        {
            var impulse = PhysicalEntityImpulseAction.Create();

            impulse.impulse = vImpulse;

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

            return(PhysicsInterop.ActionImpulse(Handle, ref impulse));
        }
Ejemplo n.º 5
0
        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 (PhysicsInterop.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);
        }
Ejemplo n.º 6
0
 public bool GetParameters(ref ParticleParameters parameters)
 {
     return(PhysicsInterop.GetParticleParams(Handle, ref parameters));
 }
Ejemplo n.º 7
0
 public bool SetSimulationParameters(ref PhysicalSimulationParameters flags)
 {
     return(PhysicsInterop.SetSimulationParams(Handle, ref flags));
 }
Ejemplo n.º 8
0
 public bool SetFlags(ref PhysicalFlagsParameters flags)
 {
     return(PhysicsInterop.SetFlagParams(Handle, ref flags));
 }