IS CPP

From LFS Manual
Jump to navigationJump to search

Introduction

The Camera Position Packet is used to fully control the in-game camera, including standard and free view modes. It can also be requested by sending a TINY_SCP request.

IS_CPP packet properties
Type Name Description
byte Size 32
byte Type ISP_CPP
byte ReqI instruction: 0 / or reply: ReqI as received in the TINY_SCP
byte Zero
Vec Pos Position vector
word H heading - 0 points along Y axis
word P pitch
word R roll
byte ViewPLID Unique ID of viewed player (0 = none)
byte InGameCam InGameCam (as reported in StatePack)
float FOV 4-byte float: FOV in degrees
word Time Time in ms to get there (0 means instant)
word Flags ISS state flags (see below)

Packet Details

Size

The size of the packet is always 32 bytes.

Type

The packet type from the ISP_ enumeration, always ISP_CPP.

ReqI

ReqI is equal to zero, unless the packet is a reply to a TINY_SCP request.

Pos

Position vector, 3 signed integers representing the X, Y, and Z coordinates, where 65536 represents 1 metre.

H

The camera heading, a value of 0 points along the Y axis. 32768 represents 180 degrees.

P

The camera pitch, a value of 0 points "forward" horizontally. 32768 represents 180 degrees.

R

The camera roll, a value of 0 means no roll. 32768 represents 180 degrees.

ViewPLID

The unique ID of the player being viewed. A value of 0 means no player is viewed (free view only).

InGameCam

The standard camera view, as reported in IS_STA.

FOV

The field of view of the camera, in degrees.

Time

Time in ms to get to the destination. This allows smooth camera movement. A value of 0 will instantly set the camera.

Flags

A number of ISS_ state flags can be set in this packet:

  • ISS_SHIFTU: free view mode
  • ISS_SHIFTU_FOLLOW: follow the car designated by ViewPLID
  • ISS_VIEW_OVERRIDE: override the user's view

Notes

To convert the heading, pitch, and roll values to angles in degrees:

  • heading (from positive Y axis) = H / 32768 * 180 - 180
  • pitch = -P / 32768 * 180
  • roll = R / 32768 * 180

To convert angles in degrees to heading, pitch, and roll values:

  • H = (180 + heading) * 32768 / 180
  • P = -pitch * 32768 / 180
  • R = roll * 32768 / 180

Note that the /cp command uses a different format (heading 0 points to negative Y, roll is a floating point value, positive pitch looks down...).