-
Notifications
You must be signed in to change notification settings - Fork 0
KAI_Math
KAI_Math is a non-mixin container class, that has several math-related functions stored into it. These functions are all clearscoped and static, allowing them to be called from nearly anywhere in ZScript as needed.
- V1, V2: The two values to interpolate between.
- Time: The span of time to interpolate V1 into V2 over time.
- Returns the interpolated value between V1 and V2.
Linearly interpolates between two values, produce a smoothed blend of the two.
- Val: The value to map.
- O_Min, O_Max, N_Min, N_Max: Information needed.
- Returns a linear mapped value as a double.
Remap Val from the <o_min, o_max> range to the <n_min, n_max> range. (This was written by RaveYard, not me (inkoalwetrust), so I don't know what it means.)
- A, B: The two Vector3s the line is made out of.
- C: The coordinate point to check.
- How far away C is from the line formed by A and B.
Creates a line using A and B as the ends. Then calculates the lines' distance from C.
- Other: The actor to offset from.
- Offs: The offsets relative to the Other actor.
- NoPortal: Should the function not account for static portals ? Default is false.
- Flags: The flags to pass to the function.
- V3R_NOANGLE: Do not account for the Other's angle.
- V3R_NOPITCH: Do not account for the Other's pitch.
- V3R_NOROLL: Do not account for the Other's roll.
- V3R_ANGLEONLY: Implies V3R_NOPITCH and V3R_NOROLL. This is what vehicle turrets use to keep themselves attached on their vehicles.
- Returns a position coordinate that was offset relative to Other's facing direction.
This function returns a position relative to the angle that Other is facing, with the specified offsets. This function behaves similarly to the offsets in A_Warp(). In fact, the function is primarily used by the KAI library to act like a cheaper A_Warp() alongside SetOrigin().
If this code is put on an actor class, and the actor has a master, then it will attach itself on top of its' masters' hitbox, 128 units forward relative to the masters' origin, effectively attaching in front of it.
Override Void Tick()
{
Super.Tick();
If (IsFrozen()) Return;
If (Master) SetOrigin (KAI_Math.Vec3OffsetRelative(Master,(128,0,Master.Height)),True);
}
- OtherPos: The actor to offset from.
- Offs: The offsets relative to OtherPos.
- Angles: The angle, pitch, roll (In that vector member order) that OtherPos is aimed at towards Offs.
- NoPortal: Should the function not account for static portals ? Default is false.
- Returns a position coordinate that was offset relative to OtherPos and the Angles vector passed to it..
Works like Vec3OffsetRelative, except that it only works with vector positions, and the aiming direction of OtherPos is directly specified by passing values to Angles.
- Angle: The angle to check at.
- Pitch: The pitch to check at.
- Len: How far the check extends, default is 1.0.
- Returns the Vector3 position that Angle and Pitch are facing at Length map units away.
Works like the native AngleToVector(), but also accounts for pitch.
- Vec: The vector variable to check
- Returns true if Vec is null/NaN, false otherwise.
This function checks if Vec is null, that is to say, its' value is (Double.NaN,Double.NaN,Double.NaN), or -2147483647 on each member, NOT (0,0,0).
- Vec: The vector variable to check
- Returns true if all members of Vec are 0, false otherwise.
Checks if Vec is (0,0,0).
- Origin: The non (0,0) origin to rotate Vec around.
- Vec: The vector to rotate around Origin.
- Angle: The angle to rotate Vec by.
- The Vec rotated X angles around Origin
Rotates a vector around a relative origin, as opposed to RotateVector(), which only rotates vectors relative to the world origin itself, and which this function is a wrapper for.
- Home
- Features
- Classes
- Functions
- Guides