Skip to main content

FastCast

FastCast is the root class of the module and offers the surface level methods required to make it work. This is the object returned from require(FastCast).

Functions

newBehavior

FastCast.newBehavior() → FastCastBehavior

Creates a new FastCastBehavior, which contains information necessary to Fire the cast properly.

new

FastCast.new() → Caster
WARNING

You must initialize the Caster before using it. Failing to do so will result in nothing happening when attempting to fire!

Contructs a new Caster object.

Init

FastCast:Init(
numWorkersnumber,--

The number of worker VMs to create for this Caster. Must be greater than 1.

newParentFolder,--

The Folder in which to place the FastCastVMs Folder

newNamestring,--

The name to give the FastCastVMs Folder containing worker scripts.

ContainerParentFolder,--

The parent Folder in which to place the worker VM Containers.

VMContainerNameFolder,--

The name to give to the Containers housing each worker VM.

VMnamestring,--

The name to give each worker VM.

useBulkMoveToboolean,--

Whether to enable BulkMoveTo for the CosmeticBulletObjects

FastCastEventsModuleModuleScript,--

The ModuleScript containing the FastCastEvents, A table of callback functions (events/hooks) used by ActiveCast..

useObjectCacheboolean,--

Whether to use ObjectCache for the Caster

TemplateBasePart | Model,--

The template object to use for the ObjectCache (if enabled)

CacheSizenumber,--

The size of the ObjectCache (if enabled)

CacheHolderInstance--

The Instance in which to place cached objects (if enabled)

) → ()

Initializes the Caster with the given parameters. This is required before firing using Raycasts in the Caster or nothing will happen!

SetFastCastEventsModule

FastCast:SetFastCastEventsModule(
moduleScriptModuleScript--

The FastCastEventsModule to set.

) → ()

Set the FastCastEventsModule for all BaseCasts created from this Caster.

RaycastFire

FastCast:RaycastFire(
originVector3,--

The origin of the raycast.

directionVector3,--

The direction of the raycast.

velocityVector3 | number,--

The velocity of the raycast.

BehaviorDataFastCastBehavior?--

The behavior data for the raycast.

) → ()

Raycasts the Caster with the specified parameters.

BlockcastFire

FastCast:BlockcastFire(
originVector3,--

The origin of the blockcast.

SizeVector3,--

The size of the blockcast.

directionVector3,--

The direction of the blockcast.

velocityVector3 | number,--

The velocity of the blockcast.

BehaviorDataFastCastBehavior?--

The behavior data for the blockcast.

) → ()

Blockcasts the Caster with the specified parameters.

SpherecastFire

FastCast:SpherecastFire(
originVector3,--

The origin of the spherecast.

Radiusnumber,--

The radius of the spherecast.

directionVector3,--

The direction of the spherecast.

velocityVector3 | number,--

The velocity of the spherecast.

BehaviorDataFastCastBehavior?--

The behavior data for the spherecast.

) → ()

Spherecasts the Caster with the specified parameters.

GetVelocityCast

FastCast:GetVelocityCast(castvaildcast) → ()

Gets the velocity of an ActiveCast.

@method GetVelocityCast
@param cast vaildcast -- The active cast to get the velocity of.
@within FastCast
@return Vector3 -- The current velocity of the ActiveCast.

GetAccelerationCast

FastCast:GetAccelerationCast(castvaildcast) → ()

Gets the acceleration of an ActiveCast.

@method GetAccelerationCast
@param cast vaildcast -- The active cast to get the acceleration of.
@within FastCast
@return Vector3 -- The current acceleration of the ActiveCast.

GetPositionCast

FastCast:GetPositionCast(castvaildcast) → ()

Gets the position of an ActiveCast.

@method GetPositionCast
@param cast vaildcast -- The active cast to get the position of.
@within FastCast
@return Vector3 -- The current position of the ActiveCast.

SetVelocityCast

FastCast:SetVelocityCast(
castvaildcast,
velocityVector3
) → ()

Sets the velocity of an ActiveCast to the specified Vector3.

@method SetVelocityCast
@param cast vaildcast -- The active cast to modify.
@param velocity Vector3 -- The new velocity to set.
@within FastCast

SetAccelerationCast

FastCast:SetAccelerationCast(
castvaildcast,
accelerationVector3
) → ()

Sets the acceleration of an ActiveCast to the specified Vector3.

@method SetAccelerationCast
@param cast vaildcast -- The active cast to modify.
@param acceleration Vector3 -- The new acceleration to set.
@within FastCast

SetPositionCast

FastCast:SetPositionCast(
castvaildcast,--

The active cast to modify.

positionVector3--

The new position to set.

) → ()

Sets the position of an ActiveCast to the specified Vector3.

PauseCast

FastCast:PauseCast(
castvaildcast,
valueboolean
) → ()

Pauses or resumes simulation for an ActiveCast.

@method PauseCast
@param cast vaildcast -- The active cast to modify.
@param value boolean -- Whether to pause (true) or resume (false) the cast.
@within FastCast

AddPositionCast

FastCast:AddPositionCast(
castvaildcast,
positionVector3
) → ()

Add position to an ActiveCast with the specified Vector3.

@method AddPositionCast
@param cast vaildcast -- The active cast to modify.
@param position Vector3 -- The new position to add.
@within FastCast

AddVelocityCast

FastCast:AddVelocityCast(
castvaildcast,
velocityVector3
) → ()

Add velocity to an ActiveCast with the specified Vector3.

@method AddVelocityCast
@param cast vaildcast -- The active cast to modify.
@param velocity Vector3 -- The new velocity to add.
@within FastCast

AddAccelerationCast

FastCast:AddAccelerationCast(
castvaildcast,
accelerationVector3
) → ()

Add acceleration to an ActiveCast with the specified Vector3.

@method AddAccelerationCast
@param cast vaildcast -- The active cast to modify.
@param acceleration Vector3 -- The new acceleration to add.
@within FastCast

SyncChangesToCast

FastCast:SyncChangesToCast(castvaildcast) → ()

Synchronize new changes to the ActiveCast.

@method SyncChangesToCast
@param cast vaildcast -- The active cast to synchronize.
@within FastCast

TerminateCast

FastCast:TerminateCast(
castvaildcast,--

The active cast to terminate.

castTerminatingFunction(castvaildcast) → ())?--

Optional callback invoked just before the cast is terminated.

) → ()

Terminate function for casts

SetBulkMoveEnabled

FastCast:SetBulkMoveEnabled(enabledboolean) → ()

Sets whether BulkMoveTo is enabled for this Caster.

SetObjectCacheEnabled

FastCast:SetObjectCacheEnabled(enabledboolean) → ()

Sets whether ObjectCache is enabled for this Caster. It is recommended to interface with this via FastCast:Init() instead.

Destroy

FastCast:Destroy() → ()

Destroy's a Caster, cleaning up all resources used by it.

Show raw api
{
    "functions": [
        {
            "name": "newBehavior",
            "desc": "Creates a new FastCastBehavior, which contains information necessary to Fire the cast properly.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "FastCastBehavior"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 206,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "new",
            "desc": ":::warning\n\nYou must [initialize](FastCast#Init) the Caster before using it. Failing to do so will result in nothing happening when attempting to fire!\n\n:::\nContructs a new Caster object.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Caster"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 222,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "Init",
            "desc": "Initializes the Caster with the given parameters. This is required before firing using Raycasts in the Caster or nothing will happen!",
            "params": [
                {
                    "name": "numWorkers",
                    "desc": "The number of worker VMs to create for this Caster. Must be greater than 1.",
                    "lua_type": "number"
                },
                {
                    "name": "newParent",
                    "desc": "The Folder in which to place the FastCastVMs Folder",
                    "lua_type": "Folder"
                },
                {
                    "name": "newName",
                    "desc": "The name to give the FastCastVMs Folder containing worker scripts.",
                    "lua_type": "string"
                },
                {
                    "name": "ContainerParent",
                    "desc": "The parent Folder in which to place the worker VM Containers.",
                    "lua_type": "Folder"
                },
                {
                    "name": "VMContainerName",
                    "desc": "The name to give to the Containers housing each worker VM.",
                    "lua_type": "Folder"
                },
                {
                    "name": "VMname",
                    "desc": "The name to give each worker VM.",
                    "lua_type": "string"
                },
                {
                    "name": "useBulkMoveTo",
                    "desc": "Whether to enable BulkMoveTo for the [CosmeticBulletObjects](TypeDefinitions#CastRayInfo)",
                    "lua_type": "boolean"
                },
                {
                    "name": "FastCastEventsModule",
                    "desc": "The ModuleScript containing the FastCastEvents, A table of callback functions (events/hooks) used by ActiveCast..",
                    "lua_type": "ModuleScript"
                },
                {
                    "name": "useObjectCache",
                    "desc": "Whether to use ObjectCache for the [Caster](TypeDefinitions#Caster)",
                    "lua_type": "boolean"
                },
                {
                    "name": "Template",
                    "desc": "The template object to use for the ObjectCache (if enabled)",
                    "lua_type": "BasePart | Model"
                },
                {
                    "name": "CacheSize",
                    "desc": "The size of the ObjectCache (if enabled)",
                    "lua_type": "number"
                },
                {
                    "name": "CacheHolder",
                    "desc": "The Instance in which to place cached objects (if enabled)",
                    "lua_type": "Instance"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 256,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SetFastCastEventsModule",
            "desc": "Set the FastCastEventsModule for all BaseCasts created from this Caster.",
            "params": [
                {
                    "name": "moduleScript",
                    "desc": "The FastCastEventsModule to set.",
                    "lua_type": "ModuleScript"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 357,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "RaycastFire",
            "desc": "Raycasts the Caster with the specified parameters.",
            "params": [
                {
                    "name": "origin",
                    "desc": "The origin of the raycast.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "direction",
                    "desc": "The direction of the raycast.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "velocity",
                    "desc": "The velocity of the raycast.",
                    "lua_type": "Vector3 | number"
                },
                {
                    "name": "BehaviorData",
                    "desc": "The behavior data for the raycast.",
                    "lua_type": "FastCastBehavior?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 376,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "BlockcastFire",
            "desc": "Blockcasts the Caster with the specified parameters.",
            "params": [
                {
                    "name": "origin",
                    "desc": "The origin of the blockcast.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "Size",
                    "desc": "The size of the blockcast.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "direction",
                    "desc": "The direction of the blockcast.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "velocity",
                    "desc": "The velocity of the blockcast.",
                    "lua_type": "Vector3 | number"
                },
                {
                    "name": "BehaviorData",
                    "desc": "The behavior data for the blockcast.",
                    "lua_type": "FastCastBehavior?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 404,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SpherecastFire",
            "desc": "Spherecasts the Caster with the specified parameters.",
            "params": [
                {
                    "name": "origin",
                    "desc": "The origin of the spherecast.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "Radius",
                    "desc": "The radius of the spherecast.",
                    "lua_type": "number"
                },
                {
                    "name": "direction",
                    "desc": "The direction of the spherecast.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "velocity",
                    "desc": "The velocity of the spherecast.",
                    "lua_type": "Vector3 | number"
                },
                {
                    "name": "BehaviorData",
                    "desc": "The behavior data for the spherecast.",
                    "lua_type": "FastCastBehavior?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 432,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "GetVelocityCast",
            "desc": "Gets the velocity of an ActiveCast.\n\n\t@method GetVelocityCast\n\t@param cast vaildcast -- The active cast to get the velocity of.\n\t@within FastCast\n\t@return Vector3 -- The current velocity of the ActiveCast.",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 458,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "GetAccelerationCast",
            "desc": "Gets the acceleration of an ActiveCast.\n\n\t@method GetAccelerationCast\n\t@param cast vaildcast -- The active cast to get the acceleration of.\n\t@within FastCast\n\t@return Vector3 -- The current acceleration of the ActiveCast.",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 478,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "GetPositionCast",
            "desc": "Gets the position of an ActiveCast.\n\n\t@method GetPositionCast\n\t@param cast vaildcast -- The active cast to get the position of.\n\t@within FastCast\n\t@return Vector3 -- The current position of the ActiveCast.",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 493,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SetVelocityCast",
            "desc": "Sets the velocity of an ActiveCast to the specified Vector3.\n\n\t@method SetVelocityCast\n\t@param cast vaildcast -- The active cast to modify.\n\t@param velocity Vector3 -- The new velocity to set.\n\t@within FastCast",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                },
                {
                    "name": "velocity",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 514,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SetAccelerationCast",
            "desc": "Sets the acceleration of an ActiveCast to the specified Vector3.\n\n\t@method SetAccelerationCast\n\t@param cast vaildcast -- The active cast to modify.\n\t@param acceleration Vector3 -- The new acceleration to set.\n\t@within FastCast",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                },
                {
                    "name": "acceleration",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 529,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SetPositionCast",
            "desc": "Sets the position of an ActiveCast to the specified Vector3.",
            "params": [
                {
                    "name": "cast",
                    "desc": "The active cast to modify.",
                    "lua_type": "vaildcast"
                },
                {
                    "name": "position",
                    "desc": "The new position to set.",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 542,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "PauseCast",
            "desc": "Pauses or resumes simulation for an ActiveCast.\n\n\t@method PauseCast\n\t@param cast vaildcast -- The active cast to modify.\n\t@param value boolean -- Whether to pause (true) or resume (false) the cast.\n\t@within FastCast",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 557,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "AddPositionCast",
            "desc": "Add position to an ActiveCast with the specified Vector3.\n\n\t@method AddPositionCast\n\t@param cast vaildcast -- The active cast to modify.\n\t@param position Vector3 -- The new position to add.\n\t@within FastCast",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                },
                {
                    "name": "position",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 572,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "AddVelocityCast",
            "desc": "Add velocity to an ActiveCast with the specified Vector3.\n\n\t@method AddVelocityCast\n\t@param cast vaildcast -- The active cast to modify.\n\t@param velocity Vector3 -- The new velocity to add.\n\t@within FastCast",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                },
                {
                    "name": "velocity",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 587,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "AddAccelerationCast",
            "desc": "Add acceleration to an ActiveCast with the specified Vector3.\n\n\t@method AddAccelerationCast\n\t@param cast vaildcast -- The active cast to modify.\n\t@param acceleration Vector3 -- The new acceleration to add.\n\t@within FastCast",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                },
                {
                    "name": "acceleration",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 602,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SyncChangesToCast",
            "desc": "Synchronize new changes to the ActiveCast.\n\n\t@method SyncChangesToCast\n\t@param cast vaildcast -- The active cast to synchronize.\n\t@within FastCast",
            "params": [
                {
                    "name": "cast",
                    "desc": "",
                    "lua_type": "vaildcast"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 616,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "TerminateCast",
            "desc": "Terminate function for casts",
            "params": [
                {
                    "name": "cast",
                    "desc": "The active cast to terminate.",
                    "lua_type": "vaildcast"
                },
                {
                    "name": "castTerminatingFunction",
                    "desc": "Optional callback invoked just before the cast is terminated.",
                    "lua_type": "(cast: vaildcast) -> ())?"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 628,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SetBulkMoveEnabled",
            "desc": "Sets whether BulkMoveTo is enabled for this Caster.",
            "params": [
                {
                    "name": "enabled",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 664,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SetObjectCacheEnabled",
            "desc": "Sets whether ObjectCache is enabled for this Caster.\nIt is recommended to interface with this via [`FastCast:Init()`](FastCast#Init) instead.",
            "params": [
                {
                    "name": "enabled",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 681,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Destroy's a Caster, cleaning up all resources used by it.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 720,
                "path": "src/FastCast2/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "FastCast",
    "desc": "FastCast is the root class of the module and offers the surface level methods required to make it work. This is the object returned from `require(FastCast)`.",
    "source": {
        "line": 56,
        "path": "src/FastCast2/init.luau"
    }
}