Class Collider
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
A registration snapshot containing one or more world-space collision boxes. Open in GitHub
public sealed class Collider
- Inheritance
-
Collider
- Inherited Members
- Extension Methods
Properties
Bounds
The conservative axis-aligned bounds of this collider. The returned cuboid is owned by this snapshot and must not be modified.
public Cuboidd Bounds { get; }
Property Value
CanCarryEntities
Whether controlled entities standing on this collider should follow its transform.
public bool CanCarryEntities { get; }
Property Value
CollisionBoxCount
public int CollisionBoxCount { get; }
Property Value
CollisionLayer
public CollisionLayer CollisionLayer { get; }
Property Value
CollisionMask
public CollisionLayer CollisionMask { get; }
Property Value
Dimension
public int Dimension { get; }
Property Value
Id
The scene-local registration ID, retained across updates and never reused. Do not persist this ID or send it across the network.
public long Id { get; }
Property Value
IsTransformed
True when this collider was registered with local geometry and a transform.
public bool IsTransformed { get; }
Property Value
KeepsSupportedEntitiesDry
Whether controlled entities supported by this collider should ignore liquid occupying the same world position.
public bool KeepsSupportedEntitiesDry { get; }
Property Value
OwnerColliderCode
The stable owner-local code used to resolve this collider independently on each side.
public string? OwnerColliderCode { get; }
Property Value
OwnerEntityId
The entity whose own physics should ignore this collider, or zero when the collider has no entity owner.
public long OwnerEntityId { get; }
Property Value
PreviousTransform
The preceding rigid transform used to derive point velocity.
public ColliderTransform PreviousTransform { get; }
Property Value
SelectionPosition
The block represented when this collider is selected, or null when the collider is not selectable.
public BlockPos? SelectionPosition { get; }
Property Value
Transform
The current rigid transform. This is the identity transform for a world-space collider.
public ColliderTransform Transform { get; }
Property Value
TransformElapsedSeconds
The elapsed seconds between PreviousTransform and Transform, or zero when velocity is not known.
public double TransformElapsedSeconds { get; }
Property Value
Methods
CollectSweepHits(TransformedCuboidd, double, double, double, List<CollisionHit>, bool)
Appends one shared hit per intersected collision box to a caller-owned list without clearing or sorting it.
public void CollectSweepHits(TransformedCuboidd movingBox, double motionX, double motionY, double motionZ, List<CollisionHit> results, bool includeInitialOverlap = true)
Parameters
movingBoxTransformedCuboiddmotionXdoublemotionYdoublemotionZdoubleresultsList<CollisionHit>includeInitialOverlapbool
GetCollisionBox(int)
Gets an exact collision box owned by this snapshot. The returned cuboid must not be modified.
public Cuboidd GetCollisionBox(int index)
Parameters
indexint
Returns
GetCollisionBoxBounds(int)
Gets the conservative axis-aligned bounds of a collision box. The returned cuboid must not be modified.
public Cuboidd GetCollisionBoxBounds(int index)
Parameters
indexint
Returns
GetPointVelocity(double, double, double, out double, out double, out double)
Gets the world velocity of a collider-local point in blocks per second.
public void GetPointVelocity(double localX, double localY, double localZ, out double velocityX, out double velocityY, out double velocityZ)
Parameters
GetPointVelocity(FastVec3d, out FastVec3d)
public void GetPointVelocity(FastVec3d localPoint, out FastVec3d velocity)
Parameters
GetSelectionBoxIndex(int)
Gets the owning block's selection-box index for a collision box.
public int GetSelectionBoxIndex(int collisionBoxIndex)
Parameters
collisionBoxIndexint
Returns
Intersects(Cuboidd)
Tests whether any box in this collider intersects the supplied axis-aligned box.
public bool Intersects(Cuboidd box)
Parameters
boxCuboidd
Returns
Intersects(TransformedCuboidd)
Tests whether any box in this collider intersects the supplied transformed cuboid.
public bool Intersects(TransformedCuboidd box)
Parameters
Returns
IntersectsOrTouches(Cuboidd)
Tests whether any box in this collider intersects or touches the supplied axis-aligned box.
public bool IntersectsOrTouches(Cuboidd box)
Parameters
boxCuboidd
Returns
IntersectsOrTouches(TransformedCuboidd)
Tests whether any box in this collider intersects or touches the supplied transformed cuboid.
public bool IntersectsOrTouches(TransformedCuboidd box)
Parameters
Returns
PushOutX(Cuboidd, double, ref EnumPushDirection)
public double PushOutX(Cuboidd box, double motion, ref EnumPushDirection direction)
Parameters
boxCuboiddmotiondoubledirectionEnumPushDirection
Returns
PushOutY(Cuboidd, double, ref EnumPushDirection)
public double PushOutY(Cuboidd box, double motion, ref EnumPushDirection direction)
Parameters
boxCuboiddmotiondoubledirectionEnumPushDirection
Returns
PushOutZ(Cuboidd, double, ref EnumPushDirection)
public double PushOutZ(Cuboidd box, double motion, ref EnumPushDirection direction)
Parameters
boxCuboiddmotiondoubledirectionEnumPushDirection
Returns
TryGetAABBContact(int, Cuboidd, double, out CuboidContact)
Gets the outward contact normal and signed separation from one collision box to a nearby axis-aligned box.
public bool TryGetAABBContact(int collisionBoxIndex, Cuboidd box, double maxSeparation, out CuboidContact contact)
Parameters
collisionBoxIndexintboxCuboiddmaxSeparationdoublecontactCuboidContact
Returns
TryGetAABBPenetration(int, Cuboidd, out double, out double, out double)
Gets the shortest translation which moves an overlapping axis-aligned cuboid out of one collision box.
public bool TryGetAABBPenetration(int collisionBoxIndex, Cuboidd box, out double translationX, out double translationY, out double translationZ)
Parameters
Returns
TrySweep(TransformedCuboidd, double, double, double, out double)
Finds the first contact while a transformed cuboid translates through this collider without rotating.
On success, collisionFraction is in the range from zero inclusive to one exclusive; otherwise it is one.
public bool TrySweep(TransformedCuboidd movingBox, double motionX, double motionY, double motionZ, out double collisionFraction)
Parameters
movingBoxTransformedCuboiddmotionXdoublemotionYdoublemotionZdoublecollisionFractiondouble
Returns
TrySweepAABB(Cuboidd, double, double, double, out double)
Finds the first contact while an axis-aligned box translates through this collider.
On success, collisionFraction is in the range from zero inclusive to one exclusive; otherwise it is one.
public bool TrySweepAABB(Cuboidd movingBox, double motionX, double motionY, double motionZ, out double collisionFraction)
Parameters
Returns
WithTransform(int, ColliderTransform, double)
Creates an unpublished snapshot at another pose, sharing this collider's local geometry.
public Collider WithTransform(int dimension, ColliderTransform transform, double elapsedSeconds = 0)
Parameters
dimensioninttransformColliderTransformelapsedSecondsdouble