Table of Contents

Class CollisionTester

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

Fields

CollisionBoxList

public CachedCuboidList CollisionBoxList

Field Value

CachedCuboidList

entityBox

public Cuboidd entityBox

Field Value

Cuboidd

maxPos

protected BlockPos maxPos

Field Value

BlockPos

minPos

protected BlockPos minPos

Field Value

BlockPos

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 dtFac, ref Vec3d outposition, float stepHeight = 1, float YExtra = 1)

Parameters

entity Entity
entitypos EntityPos
dtFac float
outposition Vec3d
stepHeight float
YExtra float

Default 1 for the extra high collision boxes of fences

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

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

Parameters

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

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)

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 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 intoCubuid, bool alsoCheckTouch = true)

Parameters

blockAccessor IBlockAccessor
entityBoxRel Cuboidf
pos Vec3d
intoCubuid 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