API reference / @jsprismarine/protocol / CameraSplineDefinition
Class: CameraSplineDefinition
Defined in: protocol/src/structure/CameraSplineDefinition.ts:55
A CameraSplineDefinition: a named camera path a behavior pack defines and /camera plays back by name, as CameraSplinePacket lists them.
Protocol 2193 wire order: 0. name: string, "namespace:name".
total_time: little-endian float, the playback length in seconds.spline_type: optional. A presence byte, then a CameraSplineType string when present. Catmull-Rom when absent.control_points: varuint32 count, then onepositionVec3 per point, three little-endian floats.progress_key_frames: varuint32 count, then per frameprogressandtimeas floats andeasingas an optional string.rotation_key_frames: varuint32 count, then per framerotationas a Vec3,timeas a float andeasingas an optional string.
Strings are a varuint32 byte length followed by UTF-8. The schema lists spline_type and both easing fields outside required, so each carries a presence byte. The key frames of CameraInstructionPacket differ: their easing is required and written bare. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/camera-spline-definition/
Extends
Constructors
Constructor
new CameraSplineDefinition(
name?,totalTime?,splineType?,controlPoints?,progressKeyFrames?,rotationKeyFrames?):CameraSplineDefinition
Defined in: protocol/src/structure/CameraSplineDefinition.ts:66
Creates a definition. Every parameter has a default so the static deserialize can construct an instance before reading the stream.
Parameters
name?
string = ''
name, the namespaced spline identifier.
totalTime?
number = 0
total_time in seconds.
splineType?
string
spline_type. Omitted when undefined, which the client reads as Catmull-Rom.
controlPoints?
Vec3[] = []
control_points, the positions the path passes through, in order.
progressKeyFrames?
SplineDefinitionProgressKeyFrame[] = []
progress_key_frames, when the camera reaches each point of the path.
rotationKeyFrames?
SplineDefinitionRotationKeyFrame[] = []
rotation_key_frames, the camera rotation over time.
Returns
CameraSplineDefinition
Overrides
Properties
controlPoints
controlPoints:
Vec3[] =[]
Defined in: protocol/src/structure/CameraSplineDefinition.ts:70
control_points, the positions the path passes through, in order.
name
name:
string=''
Defined in: protocol/src/structure/CameraSplineDefinition.ts:67
name, the namespaced spline identifier.
progressKeyFrames
progressKeyFrames:
SplineDefinitionProgressKeyFrame[] =[]
Defined in: protocol/src/structure/CameraSplineDefinition.ts:71
progress_key_frames, when the camera reaches each point of the path.
rotationKeyFrames
rotationKeyFrames:
SplineDefinitionRotationKeyFrame[] =[]
Defined in: protocol/src/structure/CameraSplineDefinition.ts:72
rotation_key_frames, the camera rotation over time.
splineType?
optionalsplineType?:string
Defined in: protocol/src/structure/CameraSplineDefinition.ts:69
spline_type. Omitted when undefined, which the client reads as Catmull-Rom.
totalTime
totalTime:
number=0
Defined in: protocol/src/structure/CameraSplineDefinition.ts:68
total_time in seconds.
Methods
deserialize()
deserialize(
stream):void
Defined in: protocol/src/structure/CameraSplineDefinition.ts:129
Reads the six fields in wire order.
Parameters
stream
Returns
void
Throws
Error when a present easing string is not one of the docs' easing_function names.
Overrides
serialize()
serialize(
stream):void
Defined in: protocol/src/structure/CameraSplineDefinition.ts:100
Writes the six fields in wire order.
Parameters
stream
Returns
void
Overrides
deserialize()
staticdeserialize<T>(this,stream):T
Defined in: protocol/src/NetworkStructure.ts:28
Deserializes the network structure from a binary stream. The constructor runs with no arguments before the stream is read, so the class must tolerate that.
Type Parameters
T
T extends NetworkStructure
Parameters
this
Constructor<T>
stream
The binary stream to deserialize from.
Returns
T
An instance of the class T.