Caster
What is Caster?
This page describes what the Caster
How to get Caster
To get Caster, you first need to require the module:
Then, create the Caster:
Remember!
The Caster must be created only once, as it serves as the base for all casts
What is Caster?
Caster is used to start the simulation of a cast
Caster:Fire(StartPosition: Vector3, StartDirection: Vector3, Speed: number | Vector3, Target: Model | BasePart | Vector3, Properties, PhysicsProperties?)
The Caster:Fire function returns an InfoCast
Beware
If you use physics simulation, speed parameter will become not a constant speed, but an impulse
If Speed parameter is number then impluse will be applied in StartDirection
Caster contains 5 signals
PositionChanged
PositionChanged(InfoCast, Position: Vector3, Direction: Vector3, Distance: number, Target: Vector3 | BasePart, CosmeticBullet: any?, UserData: {})
This signal fires every time the Caster moves
Useful Tip!
If you want your projectile to follow the path and align with the flight direction, use this code:
RayHit
RayHit(InfoCast, RayCastResult: RaycastResult, Direction: Vector3, CosmeticBullet: any?, UserData: {})
This signal fires when the Caster hits something
Terminated
This signal fires when the Caster terminates due to exceeding the maximum flight distance, exceeding maximum flight time, or being manually terminated
What is Reason?
The Reason parameter indicates why the cast was terminated. Possible values:
Custom Reason- The reason that was defined inTerminateCastmethodSelf- The cast was terminated manuallyMaxDistance- The cast exceeded the maximum flight distanceMaxFlyTime- The cast exceeded the maximum flight time
TargetLost
TargetLost(InfoCast, LostTarget: Vector3 | BasePart, Position: Vector3, Direction: Vector3, CosmeticBullet: any?, UserData: {})
This signal fires when the Caster loses its target
CheckpointReached
CheckpointReached(InfoCast, CheckpointName: string, Position: Vector3, Direction: Vector3, CosmeticBulletTemplate: any?, UserData: {})
This signal fires when the Caster reaches a point in the trajectory
Custom Trajectory
More information about Custom Trajectories.