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
entityBox
public Cuboidd entityBox
Field Value
maxPos
public BlockPos maxPos
Field Value
minPos
public BlockPos minPos
Field Value
pos
public Vec3d pos
Field Value
tmpPos
public BlockPos tmpPos
Field Value
tmpPosDelta
public Vec3d tmpPosDelta
Field Value
Methods
AabbIntersect(Cuboidd, Cuboidd, Vec3d)
public static EnumIntersect AabbIntersect(Cuboidd aabb, Cuboidd aabb2, Vec3d motion)
Parameters
Returns
AabbIntersect(Cuboidf, double, double, double, Cuboidf, Vec3d)
public static bool AabbIntersect(Cuboidf aabb, double x, double y, double z, Cuboidf aabb2, Vec3d pos)
Parameters
Returns
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
EntityentityPos
EntityPosdtFactor
floatnewPosition
Vec3dstepHeight
floatyExtra
floatDefault 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
IBlockAccessormotionX
doublemotionY
doublemotionZ
doublestepHeight
floatyExtra
floatdimension
int
GetCollidingBlock(IBlockAccessor, Cuboidf, Vec3d, bool)
public Block GetCollidingBlock(IBlockAccessor blockAccessor, Cuboidf entityBoxRel, Vec3d pos, bool alsoCheckTouch = true)
Parameters
blockAccessor
IBlockAccessorentityBoxRel
Cuboidfpos
Vec3dalsoCheckTouch
bool
Returns
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
IBlockAccessorentityBoxRel
Cuboidfpos
Vec3dalsoCheckTouch
bool
Returns
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
IBlockAccessorentityBoxRel
Cuboidfpos
Vec3dintoCuboid
CuboiddalsoCheckTouch
bool
Returns
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
IBlockAccessorentityBoxRel
Cuboidfpos
Vec3dalsoCheckTouch
bool
Returns
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)