public void Explode() { if (explosion.rmax == 0) { explosion.rmax = 0.0001f; } explosion.nOccRes = explosion.rmax > 50 ? 0 : 16; affectedEnts = NativePhysicsMethods.SimulateExplosion(explosion); }
public void Physicalize(PhysicalizationParams physicalizationParams) { NativePhysicsMethods.Physicalize(this.GetIEntity(), physicalizationParams); if (physicalizationParams.type == PhysicalizationType.None) { _physics = null; } else { _physics = PhysicalEntity.TryGet(NativePhysicsMethods.GetPhysicalEntity(EntityHandle)); } }
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)); }
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); }
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); }
public bool GetParameters(ref ParticleParameters parameters) { return(NativePhysicsMethods.GetParticleParams(Handle, ref parameters)); }
/// <summary> /// Save the current physics settings. /// </summary> public void Save() { NativePhysicsMethods.Physicalize(Owner.GetIEntity(), _params); }
internal PhysicalEntity(EntityBase _entity) : this() { owner = _entity; Handle = NativePhysicsMethods.GetPhysicalEntity(Owner.GetIEntity()); }
public bool SetSimulationParameters(ref PhysicalSimulationParameters flags) { return(NativePhysicsMethods.SetSimulationParams(Handle, ref flags)); }
public bool SetFlags(ref PhysicalFlagsParameters flags) { return(NativePhysicsMethods.SetFlagParams(Handle, ref flags)); }