Class PhysicsSettings
Implements Physics Settings
Inheritance
Namespace: VRage.ModAPI
Assembly: VRage.Game.dll
Syntax
public sealed class PhysicsSettings : ValueType
Fields
AngularDamping
Gets or Sets the Angular Damping. SE default value is 0.1
Declaration
public float AngularDamping
Field Value
Type | Description |
---|---|
System.Single |
CollisionLayer
Collision layer. Makes your entity react on collisions with entities that having certain layers TargetDummyLayer = 6 BlockPlacementTestCollisionLayer = 7 MissileLayer = 8 NoVoxelCollisionLayer = 9 LightFloatingObjectCollisionLayer = 10 VoxelLod1CollisionLayer = 11 NotCollideWithStaticLayer = 12 StaticCollisionLayer = 13 CollideWithStaticLayer = 14 DefaultCollisionLayer = 15 DynamicDoubledCollisionLayer = 16 KinematicDoubledCollisionLayer = 17 CharacterCollisionLayer = 18 NoCollisionLayer = 19 DebrisCollisionLayer = 20 GravityPhantomLayer = 21 CharacterNetworkCollisionLayer = 22 FloatingObjectCollisionLayer = 23 ObjectDetectionCollisionLayer = 24 VirtualMassLayer = 25 CollectorCollisionLayer = 26 AmmoLayer = 27 VoxelCollisionLayer = 28 ExplosionRaycastLayer = 29 CollisionLayerWithoutCharacter = 30 RagdollCollisionLayer = 31
Declaration
public ushort CollisionLayer
Field Value
Type | Description |
---|---|
System.UInt16 |
DetectorColliderCallback
If it is not null, then it would be call this callback each time entity Enters/Leaves it's collision. Also removes physical collision (Now all entities can go through it) CollisionCallback is called from parallel thread, and called once per HkBody. Grids can have more than 100 bodies. Try find best collision layer, to filter unneeded collisions and improve performance If you trying detect grids:
protected MyConcurrentHashSet<long> m_containedEntities = new MyConcurrentHashSet<long>();
var topEntity = entity.GetTopMostParent() as MyEntity;
if (m_containedEntities.Add(topEntity.EntityId))
{
MyAPIGateway.Utilities.InvokeOnGameThread(() =>
{
//Called once in main thread
});
}
Declaration
public Action<IMyEntity, bool> DetectorColliderCallback
Field Value
Type | Description |
---|---|
System.Action<IMyEntity, System.Boolean> |
Entity
For modders: You can create your own entities with this code.
var entity = new MyEntity();
entity.WorldMatrix = MatrixD.Identity;
entity.Init(new StringBuilder("Name"), "Models\\Cubes\\Large\\GeneratorLarge.mwm", null, null, "Models\\Cubes\\Large\\GeneratorLarge.mwm");
MyAPIGateway.Entities.AddEntity(entity);
Declaration
public IMyEntity Entity
Field Value
Type | Description |
---|---|
IMyEntity |
IsPhantom
Is mainly used, to detect if block can be placed at this position
Declaration
public bool IsPhantom
Field Value
Type | Description |
---|---|
System.Boolean |
LinearDamping
Gets or Sets the Linear Damping in meters per tick
Declaration
public float LinearDamping
Field Value
Type | Description |
---|---|
System.Single |
LocalCenter
Gets or Sets the Center of physical shape
Declaration
public Vector3 LocalCenter
Field Value
Type | Description |
---|---|
Vector3 |
Mass
Gets or Sets the mass of object
Declaration
public Nullable<ModAPIMass> Mass
Field Value
Type | Description |
---|---|
System.Nullable<ModAPIMass> |
MaterialType
Gets or Sets From what material object is. Example: Rock,Metal,Ammo,Character,Wood,Thruster_large,Thruster_small,Missile
Declaration
public MyStringHash MaterialType
Field Value
Type | Description |
---|---|
MyStringHash |
RigidBodyFlags
Gets or Sets the Flags, defining behavioral features
Declaration
public RigidBodyFlag RigidBodyFlags
Field Value
Type | Description |
---|---|
RigidBodyFlag |
WorldMatrix
Gets or Sets the World matrix of physical shape
Declaration
public MatrixD WorldMatrix
Field Value
Type | Description |
---|---|
MatrixD |