Rebound entity stuff

added function to get a local offset world position from a point
updated entities to automatically process next queued action without needing to call processnextaction
Added client freeze, circle, and bobupanddown for client/rebound entity manipulation
This commit is contained in:
gononono64 committed 2025-05-04 11:11:29 -05:00
1 parent 3cb9829f4f
commit 4d8b2ff203
5 files changed
+174 -11

No files matched your search

+40 -1
View File
@@ -1,4 +1,4 @@
Math = {}
Math = Math or {}
function Math.Clamp(value, min, max)
return math.min(math.max(value, min), max)
@@ -46,5 +46,44 @@ function Math.DirectionToTarget(fromV3, toV3)
return Math.Normalize3D(toV3.x - fromV3.x, toV3.y - fromV3.y, toV3.z - fromV3.z)
end
function Deg2Rad(deg)
return deg * math.pi / 180.0
end
function RotVector(pos, rot)
local pitch = Deg2Rad(rot.x)
local roll = Deg2Rad(rot.y)
local yaw = Deg2Rad(rot.z)
local cosY = math.cos(yaw)
local sinY = math.sin(yaw)
local cosP = math.cos(pitch)
local sinP = math.sin(pitch)
local cosR = math.cos(roll)
local sinR = math.sin(roll)
local m11 = cosY * cosR + sinY * sinP * sinR
local m12 = sinR * cosP
local m13 = -sinY * cosR + cosY * sinP * sinR
local m21 = -cosY * sinR + sinY * sinP * cosR
local m22 = cosR * cosP
local m23 = sinR * sinY + cosY * sinP * cosR
local m31 = sinY * cosP
local m32 = -sinP
local m33 = cosY * cosP
return vector3(pos.x * m11 + pos.y * m21 + pos.z * m31, pos.x * m12 + pos.y * m22 + pos.z * m32, pos.x * m13 + pos.y * m23 + pos.z * m33)
end
function Math.GetOffsetFromMatrix(position, rotation, offset)
local rotated = RotVector(offset, rotation)
print("Rotated: " .. tostring(rotated))
return position + rotated
end
exports('Math', Math)
return Math