ActiveCast
An ActiveCast represents a bullet fired by a parent Caster. It contains methods of accessing the physics data of this specific bullet at any given time, as well as methods to alter its trajectory during runtime.
Properties
Caster Caster
Don't Change This!
This value is exposed so that the ActiveCast can communicate with the Caster that created it. Changing this value will cause a critical cast failure.
A reference to the Caster that created this ActiveCast from its Fire method.
CastStateInfo StateInfo
A container storing information about the caster's state.
CastRayInfo RayInfo
A container storing information pertaining to actual raycasting.
table UserData
A table where the user can store arbitrary information pertaining to this ActiveCast. This is a generic Lua table, so you can populate it with whatever data you want (just as you would any other lua table). This is especially helpful if you need some extra data attached to bullets that doesn't come out of the box with FastCast.
Methods
Update(number )
Internal Method!
Update(deltaTime)
is an internal method! Manually calling it will cause simulation faults and inaccuracies in your cast.
Updates the caster and increments its internal timer forward by deltaTime
seconds.
Physics Control
Info
Use discretion when calling any of these methods! Frequently calling these (e.g. every frame) may cause performance problems.
This creates a new CastTrajectory internally. If this is called and the current trajectory has not ticked forward yet, then this will simply modify the existing trajectory instead of making a new one. As a result, while calling this every frame or tick will cause lag, calling multiple methods at once one after the other will not.
Vector3 GetVelocity()
Returns the velocity of the cast at this point in time.
Vector3 GetAcceleration()
Returns the acceleration of the cast at this point in time.
Vector3 GetPosition()
Returns the position of the cast at this point in time.
SetVelocity(Vector3 )
Sets the velocity of this cast at this point in time to velocity
.
SetAcceleration(Vector3 )
Sets the acceleration of this cast at this point in time to acceleration
.
SetPosition(Vector3 )
Sets the position of this cast at this point in time to position
.
AddVelocity(Vector3 )
Adds velocity
onto the current velocity of the cast.
AddAcceleration(Vector3 )
Adds acceleration
onto the current acceleration of the cast.
AddPosition(Vector3 )
Adds position
onto the current position of the cast.
Simulation Control
Pause()
Pause this ActiveCast, preventing it from simulating. This is identical to setting Paused = true
in StateInfo
.
Resume()
Resume this ActiveCast, causing it to simulate again. This is identical to setting Paused = false
in StateInfo
.
Terminate()
Terminate this ActiveCast, disconnecting its update event and disposing of all of the data stored inside. Fires the CastTerminating
event.
Warning
This method disposes of the ActiveCast. First, it executes the CastTerminating
event. Once execution completes, it will continue with the disposal process. This means that it clears out all of the data stored inside and sets its metatable to nil
. Attempting to access any information in the ActiveCast after calling this method will result in an error.