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.

) → string--

The ActiveCast ID of the fired 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 raycast.

BehaviorDataFastCastBehavior?--

The behavior data for the raycast.

) → string--

The ActiveCast ID of the fired raycast.

Blockcasts the Caster with the specified parameters.

GetVelocityCast

FastCast:GetVelocityCast(
castActiveCastCompement | ActiveBlockcastCompement--

Compement

) → Vector3--

The current velocity of the ActiveCast.

Gets the velocity of an ActiveCast.

GetAccelerationCast

FastCast:GetAccelerationCast(
castActiveCastCompement | ActiveBlockcastCompement--

Compement

) → Vector3--

The current acceleration of the ActiveCast.

Gets the acceleration of an ActiveCast.

GetPositionCast

FastCast:GetPositionCast(
castActiveCastCompement | ActiveBlockcastCompement--

Compement

) → Vector3--

The current position of the ActiveCast.

Gets the position of an ActiveCast.

SetVelocityCast

FastCast:SetVelocityCast(
castActiveCastCompement | ActiveBlockcastCompement,--

Compement

velocityVector3--

The new velocity to set.

) → ()

Sets the velocity of an ActiveCast to the specified Vector3.

SetAccelerationCast

FastCast:SetAccelerationCast(
castActiveCastCompement | ActiveBlockcastCompement,--

Compement

accelerationVector3--

The new acceleration to set.

) → ()

Sets the acceleration of an ActiveCast to the specified Vector3.

PauseCast

FastCast:PauseCast(
castActiveCastCompement | ActiveBlockcastCompement--

Compement

) → ()

Pauses simulation for an ActiveCast.

ResumeCast

FastCast:ResumeCast(
castActiveCastCompement | ActiveBlockcastCompement--

Compement

) → ()

Resumes simulation for an ActiveCast if it was paused previously.

AddPositionCast

FastCast:AddPositionCast(
castActiveCastCompement | ActiveBlockcastCompement,--

Compement

positionVector3--

The new position to add.

) → ()

Add position to an ActiveCast with the specified Vector3.

AddVelocityCast

FastCast:AddVelocityCast(
castActiveCastCompement | ActiveBlockcastCompement,--

Compement

velocityVector3--

The new velocity to add.

) → ()

Add velocity to an ActiveCast with the specified Vector3.

AddAccelerationCast

FastCast:AddAccelerationCast(
castActiveCastCompement | ActiveBlockcastCompement,--

Compement

accelerationVector3--

The new acceleration to add.

) → ()

Add acceleration to an ActiveCast with the specified Vector3.

SyncChangesToCast

FastCast:SyncChangesToCast(
castActiveCastCompement | ActiveBlockcastCompement--

Compement

) → ()

Synchronize new changes to the ActiveCast.

TerminateCast

FastCast:TerminateCast(
castActiveCastCompement | ActiveBlockcastCompement,--

Compement

castTerminatingFunction(castvaildcast) → ()--

Function to be called when the cast is terminating

) → ()

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": 192,
                "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": 209,
                "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": 243,
                "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": 343,
                "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": [
                {
                    "desc": "The ActiveCast ID of the fired raycast.",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 363,
                "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 raycast.",
                    "lua_type": "Vector3 | number"
                },
                {
                    "name": "BehaviorData",
                    "desc": "The behavior data for the raycast.",
                    "lua_type": "FastCastBehavior?"
                }
            ],
            "returns": [
                {
                    "desc": "The ActiveCast ID of the fired raycast.",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 394,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "GetVelocityCast",
            "desc": "Gets the velocity of an ActiveCast.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                }
            ],
            "returns": [
                {
                    "desc": "The current velocity of the ActiveCast.",
                    "lua_type": "Vector3"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 422,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "GetAccelerationCast",
            "desc": "Gets the acceleration of an ActiveCast.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                }
            ],
            "returns": [
                {
                    "desc": "The current acceleration of the ActiveCast.",
                    "lua_type": "Vector3"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 442,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "GetPositionCast",
            "desc": "Gets the position of an ActiveCast.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                }
            ],
            "returns": [
                {
                    "desc": "The current position of the ActiveCast.",
                    "lua_type": "Vector3"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 461,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SetVelocityCast",
            "desc": "Sets the velocity of an ActiveCast to the specified Vector3.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                },
                {
                    "name": "velocity",
                    "desc": "The new velocity to set.",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 482,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SetAccelerationCast",
            "desc": "Sets the acceleration of an ActiveCast to the specified Vector3.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                },
                {
                    "name": "acceleration",
                    "desc": "The new acceleration to set.",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 497,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "PauseCast",
            "desc": "Pauses simulation for an ActiveCast.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 511,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "ResumeCast",
            "desc": "Resumes simulation for an ActiveCast if it was paused previously.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 525,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "AddPositionCast",
            "desc": "Add position to an ActiveCast with the specified Vector3.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                },
                {
                    "name": "position",
                    "desc": "The new position to add.",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 540,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "AddVelocityCast",
            "desc": "Add velocity to an ActiveCast with the specified Vector3.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                },
                {
                    "name": "velocity",
                    "desc": "The new velocity to add.",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 561,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "AddAccelerationCast",
            "desc": "Add acceleration to an ActiveCast with the specified Vector3.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                },
                {
                    "name": "acceleration",
                    "desc": "The new acceleration to add.",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 576,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SyncChangesToCast",
            "desc": "Synchronize new changes to the ActiveCast.",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 590,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "TerminateCast",
            "desc": "Terminate function for casts",
            "params": [
                {
                    "name": "cast",
                    "desc": "Compement",
                    "lua_type": "ActiveCastCompement | ActiveBlockcastCompement"
                },
                {
                    "name": "castTerminatingFunction",
                    "desc": "Function to be called when the cast is terminating",
                    "lua_type": "(cast: vaildcast) -> ()"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 602,
                "path": "src/FastCast2/init.luau"
            }
        },
        {
            "name": "SafeCall",
            "desc": "Calls a function safely.",
            "params": [
                {
                    "name": "f",
                    "desc": "",
                    "lua_type": "(any)"
                }
            ],
            "returns": [
                {
                    "desc": "The result of the function call.",
                    "lua_type": "any"
                }
            ],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 647,
                "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": 662,
                "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": 679,
                "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": 717,
                "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"
    }
}