Class NPCPhysicsMath
java.lang.Object
com.hypixel.hytale.server.npc.util.NPCPhysicsMath
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublestatic final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleaccelerate(double v, double a, double t, double limitSpeed) static doubleaccelerateDrag(double v, double a, double t, double terminalVelocity) static doubleaccelerateDrag(double v, double a, double t, double terminalVelocity, double p) static doubleaccelerateDragCapped(double v, double a, double t, double terminalVelocity) static doubleaccelerateDragCapped(double v, double a, double t, double terminalVelocity, double p) static doubleaccelerateToTargetSpeed(double vCurrent, double vTarget, double dt, double accel, double vMax) static doubleaccelerateToTargetSpeed(double vCurrent, double vTarget, double dt, double accel, double decel, double vMax) static doubleaccelerateToTargetSpeed(double vCurrent, double vTarget, double dt, double accel, double decel, double vMin, double vMax) static Vector3daddDifference(Vector3d result, Vector3d p, Vector3d q) static doubleblockEmptySpace(com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, int rotation, NPCPhysicsMath.Direction direction) static doubleblockHeight(com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, int rotation) static floatclampRotation(float rotation, float maxAngle) static doublecollisionSphereRadius(double boxWidth, double boxDepth, double boxHeight) static doublecollisionSphereRadius(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) static doublecollisionSphereRadius(Box boundingBox) static doublestatic doublecosAngleBetweenVectors(Vector3d v, double vLen, Vector3d w, double wLen) static doublestatic Vector3dcreateOrthogonalvector(Vector3d in, Vector3d out) static doubledeccelerateToStop(double v, double a, double t) static Vector3ddeccelerateToStop(Vector3d v, double a, double t) static doubledotProduct(double dx, double dy, double dz) static doubledotProduct(double px, double py, double pz, double qx, double qy, double qz) static doubledotProduct(double px, double py, double pz, double qx, double qy, double qz, Vector3d componentSelector) static doubledotProduct(double x, double y, double z, Vector3d componentSelector) static doubledotProduct(float dx, float dy, float dz) static doubledotProduct(float px, float py, float pz, float qx, float qy, float qz) static doubledotProduct(Vector3d base, Vector3d p, Vector3d q) static doubledotProduct(Vector3d base, Vector3d p, Vector3d q, Vector3d componentSelector) static doublegetProjectedDifference(Vector3d p, Vector3d q, Vector3d componentSelector) static Vector3dgetViewDirection(Vector3f lookDirection, Vector3d outDirection) static doublegravityDrag(double v, double a, double t, double terminalVelocity) static doublegravityDrag(double v, double a, double t, double terminalVelocity, double p) static floatheadingFromDirection(double x, double z, float def) static doubleheightOverGround(World world, double x, double z) static doubleheightOverGround(World world, double x, double y, double z) static intintersectLineSphere(Vector3d center, double radius, Vector3d p, Vector3d q, Vector3d x1, Vector3d x2, boolean segmentOnly) static doubleintersectLineSphereLerp(Vector3d center, double radius, Vector3d p, Vector3d q, Vector3d componentSelector) static doubleintersectLineSphereLerp(Vector3d center, double radius, Vector3d p, Vector3d q, Vector3d t1, Vector3d t2, Vector3d componentSelector) static intintersectSweptSpheres(double p1x, double p1y, double p1z, double velocity1x, double velocity1y, double velocity1z, double p2x, double p2y, double p2z, double velocity2x, double velocity2y, double velocity2z, double radius, Vector3d componentSelector, double[] results) static intintersectSweptSpheres(Vector3d p1, Vector3d velocity1, Vector3d p2, Vector3d velocity2, double radius, Vector3d componentSelector, double[] results) static intintersectSweptSpheresFootpoint(Vector3d p1, Vector3d velocity1, double radius1, Vector3d p2, Vector3d velocity2, double radius2, Vector3d componentSelector, double[] results) static booleaninViewSector(double xViewer, double zViewer, float heading, float coneAngle, double xObject, double zObject) static booleanisInvalid(double v) static booleanstatic booleanisInViewCone(double xViewer, double yViewer, double zViewer, double xViewDirection, double yViewDirection, double zViewDirection, float cosConeHalfAngle, double xObject, double yObject, double zObject) static booleanisInViewCone(double xViewDirection, double yViewDirection, double zViewDirection, float cosConeHalfAngle, double xObject, double yObject, double zObject) static booleanisInViewCone(Vector3d viewer, Vector3d viewDirection, float cosConeHalfAngle, Vector3d object) static booleanisInViewCone(Vector3d viewer, Vector3d viewDirection, float cosConeHalfAngle, Vector3d object, Vector3d componentSelector) static booleanisValid(double v) static booleanstatic doublejumpParameters(Vector3d position, Vector3d targetPosition, double gravity, Vector3d velocity) private static doublelength(double dx, double dy, double dz) static doublelerp(double a, double b, double s) static voidstatic voidlerpDistance(Vector3d start, Vector3d end, double distance, Vector3d result) static floatlookatHeading(Vector3d self, Vector3d pointOfInterest, float headingHint) static Vector3dstatic booleannear(double v, double w) static booleannear(double v, double w, double epsilonLength) static booleanstatic booleanstatic voidoffsetVector(double sx, double sy, double sz, double dx, double dy, double dz, double lambda, Vector3d result) static voidoffsetVector(Vector3d start, double dx, double dy, double dz, double lambda, Vector3d result) static voidorthoComposition(Vector3d start, Vector3d end, double distanceStart, Vector3d ortho, double distance, Vector3d result) static voidorthoComposition(Vector3d start, Vector3d end, Vector3d ortho, double distance, Vector3d result) static floatpitchFromDirection(double x, double y, double z, float def) static doubleprojectedLength(Vector3d v, Vector3d componentSelector) static doubleprojectedLengthSquared(Vector3d v, Vector3d componentSelector) static Vector3dprojection(Vector3d v, Vector3d p, Vector3d result) static Vector3dprojection(Vector3d base, Vector3d v, Vector3d p, Vector3d result) static doublerayCircleIntersect(double sx, double sy, double dx, double dy, double radius) static doublerayCircleIntersect(Vector3d start, Vector3d end, Vector3d center, double radius, Vector3d normal) static voidrealignUnitVector(Vector3d v, Vector3d w, double cosine, Vector3d result) static voidrealignVector(Vector3d v, double vLen, Vector3d w, double wLen, double cosine, Vector3d result) static voidrealignVector(Vector3d v, Vector3d w, double cosine, Vector3d result) static booleanrealignVectorReturnDirection(Vector3d v, double vLen, Vector3d w, double wLen, double cosine, Vector3d result) static Vector3dstatic Vector3dstatic doublesquaredDistProjected(double px, double py, double pz, double qx, double qy, double qz, Vector3d normal) static doublesquaredDistProjected(double px, double py, double pz, Vector3d q, Vector3d normal) static Vector3dsubtractVector(Vector3d p, Vector3d q, Vector3d result) static floatturnAngle(float from, float to)
-
Field Details
-
EPSILON_LENGTH
public static final double EPSILON_LENGTH- See Also:
-
EPSILON_LENGTH_2
public static final double EPSILON_LENGTH_2- See Also:
-
-
Constructor Details
-
NPCPhysicsMath
private NPCPhysicsMath()
-
-
Method Details
-
near
-
near
-
near
public static boolean near(double v, double w) -
near
public static boolean near(double v, double w, double epsilonLength) -
headingFromDirection
public static float headingFromDirection(double x, double z, float def) -
pitchFromDirection
public static float pitchFromDirection(double x, double y, double z, float def) -
getViewDirection
-
cosAngleBetweenVectors
-
cosAngleBetweenVectors
-
cosAngleBetweenUnitVectors
-
realignVector
-
realignVector
-
realignUnitVector
-
realignVectorReturnDirection
-
createOrthogonalvector
-
inViewSector
public static boolean inViewSector(double xViewer, double zViewer, float heading, float coneAngle, double xObject, double zObject) -
isInViewCone
public static boolean isInViewCone(double xViewer, double yViewer, double zViewer, double xViewDirection, double yViewDirection, double zViewDirection, float cosConeHalfAngle, double xObject, double yObject, double zObject) -
isInViewCone
public static boolean isInViewCone(double xViewDirection, double yViewDirection, double zViewDirection, float cosConeHalfAngle, double xObject, double yObject, double zObject) -
isInViewCone
-
isInViewCone
-
turnAngle
public static float turnAngle(float from, float to) -
clampRotation
public static float clampRotation(float rotation, float maxAngle) -
intersectLineSphere
-
intersectLineSphereLerp
-
intersectLineSphereLerp
-
dotProduct
-
dotProduct
-
dotProduct
public static double dotProduct(double dx, double dy, double dz) -
dotProduct
public static double dotProduct(double px, double py, double pz, double qx, double qy, double qz) -
dotProduct
public static double dotProduct(float dx, float dy, float dz) -
dotProduct
public static double dotProduct(float px, float py, float pz, float qx, float qy, float qz) -
length
private static double length(double dx, double dy, double dz) -
lerpDistance
-
lerp
-
lerp
public static double lerp(double a, double b, double s) -
offsetVector
-
offsetVector
public static void offsetVector(double sx, double sy, double sz, double dx, double dy, double dz, double lambda, @Nonnull Vector3d result) -
orthoComposition
-
orthoComposition
-
lookatHeading
-
blockEmptySpace
public static double blockEmptySpace(@Nonnull com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, int rotation, @Nonnull NPCPhysicsMath.Direction direction) -
heightOverGround
-
heightOverGround
-
blockHeight
public static double blockHeight(@Nonnull com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, int rotation) -
dotProduct
-
dotProduct
public static double dotProduct(double px, double py, double pz, double qx, double qy, double qz, @Nonnull Vector3d componentSelector) -
projectedLengthSquared
-
projectedLength
-
intersectSweptSpheres
-
intersectSweptSpheresFootpoint
-
intersectSweptSpheres
public static int intersectSweptSpheres(double p1x, double p1y, double p1z, double velocity1x, double velocity1y, double velocity1z, double p2x, double p2y, double p2z, double velocity2x, double velocity2y, double velocity2z, double radius, @Nonnull Vector3d componentSelector, double[] results) -
collisionSphereRadius
-
collisionSphereRadius
public static double collisionSphereRadius(double boxWidth, double boxDepth, double boxHeight) -
collisionSphereRadius
public static double collisionSphereRadius(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
rayCircleIntersect
public static double rayCircleIntersect(double sx, double sy, double dx, double dy, double radius) -
rayCircleIntersect
-
projection
-
rejection
-
subtractVector
-
addDifference
-
projection
-
rejection
-
multiply
-
squaredDistProjected
-
squaredDistProjected
public static double squaredDistProjected(double px, double py, double pz, double qx, double qy, double qz, @Nonnull Vector3d normal) -
getProjectedDifference
-
isInvalid
public static boolean isInvalid(double v) -
isInvalid
-
isValid
public static boolean isValid(double v) -
isValid
-
jumpParameters
-
accelerate
public static double accelerate(double v, double a, double t, double limitSpeed) -
deccelerateToStop
public static double deccelerateToStop(double v, double a, double t) -
deccelerateToStop
-
accelerateDrag
public static double accelerateDrag(double v, double a, double t, double terminalVelocity, double p) -
accelerateDragCapped
public static double accelerateDragCapped(double v, double a, double t, double terminalVelocity, double p) -
accelerateDrag
public static double accelerateDrag(double v, double a, double t, double terminalVelocity) -
accelerateDragCapped
public static double accelerateDragCapped(double v, double a, double t, double terminalVelocity) -
accelerateToTargetSpeed
public static double accelerateToTargetSpeed(double vCurrent, double vTarget, double dt, double accel, double decel, double vMin, double vMax) -
accelerateToTargetSpeed
public static double accelerateToTargetSpeed(double vCurrent, double vTarget, double dt, double accel, double decel, double vMax) -
accelerateToTargetSpeed
public static double accelerateToTargetSpeed(double vCurrent, double vTarget, double dt, double accel, double vMax) -
gravityDrag
public static double gravityDrag(double v, double a, double t, double terminalVelocity, double p) -
gravityDrag
public static double gravityDrag(double v, double a, double t, double terminalVelocity)
-