Table of Contents

Class CollisionTester

Namespace
Vintagestory.API.MathTools
Assembly
VintagestoryAPI.dll
public class CollisionTester
Inheritance
CollisionTester
Derived
Inherited Members
Extension Methods

Fields

CollisionBoxList

public CachedCuboidList CollisionBoxList

Field Value

CachedCuboidList

entityBox

public Cuboidd entityBox

Field Value

Cuboidd

maxPos

public BlockPos maxPos

Field Value

BlockPos

minPos

public BlockPos minPos

Field Value

BlockPos

pos

public Vec3d pos

Field Value

Vec3d

tmpPos

public BlockPos tmpPos

Field Value

BlockPos

tmpPosDelta

public Vec3d tmpPosDelta

Field Value

Vec3d

Methods

AabbIntersect(Cuboidd, Cuboidd, Vec3d)

public static EnumIntersect AabbIntersect(Cuboidd aabb, Cuboidd aabb2, Vec3d motion)

Parameters

aabb Cuboidd
aabb2 Cuboidd
motion Vec3d

Returns

EnumIntersect

AabbIntersect(Cuboidf, double, double, double, Cuboidf, Vec3d)

public static bool AabbIntersect(Cuboidf aabb, double x, double y, double z, Cuboidf aabb2, Vec3d pos)

Parameters

aabb Cuboidf
x double
y double
z double
aabb2 Cuboidf
pos Vec3d

Returns

bool

ApplyTerrainCollision(Entity, EntityPos, float, ref Vec3d, float, float)

Takes the entity positiona and motion and adds them, respecting any colliding blocks. The resulting new position is put into outposition

public void ApplyTerrainCollision(Entity entity, EntityPos entityPos, float dtFactor, ref Vec3d newPosition, float stepHeight = 1, float yExtra = 1)

Parameters

entity Entity
entityPos EntityPos
dtFactor float
newPosition Vec3d
stepHeight float
yExtra float

Default 1 for the extra high collision boxes of fences

GenerateCollisionBoxList(IBlockAccessor, double, double, double, float, float, int)

protected virtual void GenerateCollisionBoxList(IBlockAccessor blockAccessor, double motionX, double motionY, double motionZ, float stepHeight, float yExtra, int dimension)

Parameters

blockAccessor IBlockAccessor
motionX double
motionY double
motionZ double
stepHeight float
yExtra float
dimension int

GetCollidingBlock(IBlockAccessor, Cuboidf, Vec3d, bool)

public Block GetCollidingBlock(IBlockAccessor blockAccessor, Cuboidf entityBoxRel, Vec3d pos, bool alsoCheckTouch = true)

Parameters

blockAccessor IBlockAccessor
entityBoxRel Cuboidf
pos Vec3d
alsoCheckTouch bool

Returns

Block

GetCollidingCollisionBox(IBlockAccessor, Cuboidf, Vec3d, bool)

If given cuboidf collides with the terrain, returns the collision box it collides with. By default also checks if the cuboid is merely touching the terrain, set alsoCheckTouch to disable that.

public Cuboidd GetCollidingCollisionBox(IBlockAccessor blockAccessor, Cuboidf entityBoxRel, Vec3d pos, bool alsoCheckTouch = true)

Parameters

blockAccessor IBlockAccessor
entityBoxRel Cuboidf
pos Vec3d
alsoCheckTouch bool

Returns

Cuboidd

GetCollidingCollisionBox(IBlockAccessor, Cuboidf, Vec3d, ref Cuboidd, bool)

Tests given cuboidf collides with the terrain. By default also checks if the cuboid is merely touching the terrain, set alsoCheckTouch to disable that.

public bool GetCollidingCollisionBox(IBlockAccessor blockAccessor, Cuboidf entityBoxRel, Vec3d pos, ref Cuboidd intoCuboid, bool alsoCheckTouch = true)

Parameters

blockAccessor IBlockAccessor
entityBoxRel Cuboidf
pos Vec3d
intoCuboid Cuboidd
alsoCheckTouch bool

Returns

bool

IsColliding(IBlockAccessor, Cuboidf, Vec3d, bool)

Tests given cuboidf collides with the terrain. By default also checks if the cuboid is merely touching the terrain, set alsoCheckTouch to disable that.

public bool IsColliding(IBlockAccessor blockAccessor, Cuboidf entityBoxRel, Vec3d pos, bool alsoCheckTouch = true)

Parameters

blockAccessor IBlockAccessor
entityBoxRel Cuboidf
pos Vec3d
alsoCheckTouch bool

Returns

bool

PeekCollision(Entity, EntityPos, float, ref Vec3d)

Does not call block collide events or set collided flags. Used for peeking position in the future.

public void PeekCollision(Entity entity, EntityPos entityPos, float dtFactor, ref Vec3d newPosition)

Parameters

entity Entity
entityPos EntityPos
dtFactor float
newPosition Vec3d