local thisLevel, waterWheelAxle
local currentFrameAngVector_Normalized = 0
local lastFrameAngVector_Normalized = 0
local angularVelocity = 0
local radiansToDegreesConstant = 180 / math.pi
function OnScriptLoaded(level, obj)
  thisLevel = level
  waterWheelAxle = obj
  currentFrameAngVector_Normalized = waterWheelAxle:GetWorldUp():Normalized()
  lastFrameAngVector_Normalized = currentFrameAngVector_Normalized
  game.SubObject.Sleep(obj)
  game.SubObject.SetForgetOnCheckpoint(obj)
end
function GetWaterWheelAngularVelocityRTPC()
  currentFrameAngVector_Normalized = waterWheelAxle:GetWorldUp():Normalized()
  local dotProductOfNormals = currentFrameAngVector_Normalized:Dot(lastFrameAngVector_Normalized)
  if 1 < dotProductOfNormals then
    dotProductOfNormals = 1
  end
  angularVelocity = math.acos(dotProductOfNormals) * radiansToDegreesConstant * thisLevel:GetUnitTime() * 1000
  lastFrameAngVector_Normalized = currentFrameAngVector_Normalized
  return angularVelocity
end
