Change Gravity and FOV

I’m making a prop hunt type game, how can I change the gravity and fov based on the size of the model they morphed into?


You can mess around with the scale numbers.

local camera: Camera = workspace.CurrentCamera

local DEFAULT_FOV: number = camera.FieldOfView
local DEFAULT_GRAVITY: number = workspace.Gravity

local SCALE_FOV: number = 500 --higher number means higher FOV
local SCALE_GRAVITY: number = 5000 --higher number means higher gravity

function onPropChanged(propModel: Model)
	local extents: Vector3 = propModel:GetExtentsSize() --get size 
	local objSize: number = (extents.X+extents.Y+extents.Z)/3 --get average size
	workspace.Gravity = objSize/DEFAULT_GRAVITY * SCALE_GRAVITY
	camera.FieldOfView = objSize/DEFAULT_FOV * SCALE_FOV


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.