Change the camera’s configuration||doc135639

September 20, 2022


 Blockman:changeCameraCfg(config, modeViewIndex)
  • The class to which the function belongs:Blockman


Change the camera configuration corresponding to the viewing angle type, the value of the viewing angle type is 0 ~ 5 .


Variable name type Description
config table View configuration
modeViewIndex int Type of perspective, -1 is the current perspective

View configuration

name type Defaults Description
enable boolean true Is it possible to switch to this perspective
enableCollisionDetect boolean true Whether to advance the camera when blocks block the view
viewFovAngle int 75 Wide angle of view
lockViewPos boolean false Whether to lock the camera position
lockSlideScreen boolean false Whether to lock the sliding screen to rotate the camera
offset Vector3 {x=0, y=0, z=0} camera offset
distance float 4 camera distance
pos Vector3 {x=0, y=0, z=0} Coordinate point when the camera position is locked
liftMinHeight float 0 When the jump height reaches a certain level, the viewing angle will be raised


  • When changing the viewing angle configuration again, the default value will return to the value set previously

Code Samples

Change the camera's perspective configuration with perspective type 3, and then we can switch to this camera's perspective by switching the perspective

local cameraCfg = {
    enable = true,
    lockViewPos = true,
    pos = Lib.v3(0,6,0)
Blockman.Instance():changeCameraCfg(cameraCfg, 3)