sm.camera
The camera library contains methods related to the localPlayer's camera view.
In first-person view the camera is located inside the player's head, whereas in third-person view it floats behind them.
This library can only be used on the client.
Functions
cameraSphereCast
sm.camera.cameraSphereCast( radius, start, direction )
Client-Only
Performs a distance convex sweep with the shape of a sphere, from a position with a given direction.
Arguments:radius
[ number ]: The radius of the cast sphere.start
[ Vec3 ]: The start position.direction
[ Vec3 ]: The cast direction and range.
- [ number ]: The fraction of the distance reached until collision.
getCameraPullback
sm.camera.getCameraPullback()
Client-Only
Returns the camera's zoom step.
Returns:- [ number ]: How far away the camera is from the player while standing.
- [ number ]: How far away the camera is from the player while seated.
getCameraState
sm.camera.getCameraState()
Client-Only
Returns the camera's control state, see sm.camera.states.
Returns:- [ int ]: The camera state.
getDefaultFov
sm.camera.getDefaultFov()
Client-Only
Returns the camera's default FOV angle.
Returns:- [ number ]: The default FOV.
getDefaultPosition
sm.camera.getDefaultPosition()
Client-Only
Returns the world postition where the camera should be by default.
Returns:- [ Vec3 ]: The position.
getDefaultRotation
sm.camera.getDefaultRotation()
Client-Only
Returns the world rotation where the camera should be by default.
Returns:- [ Quat ]: The rotation.
getDirection
sm.camera.getDirection()
Client-Only
Returns the direction the camera is aiming.
Returns:- [ Vec3 ]: The direction.
getFov
sm.camera.getFov()
Client-Only
Returns the camera's FOV.
Returns:- [ number ]: The FOV.
getPosition
sm.camera.getPosition()
Client-Only
Returns the camera's world position.
Returns:- [ Vec3 ]: The position.
getRight
sm.camera.getRight()
Client-Only
Returns the right-vector perpendicular to the camera's aim.
Returns:- [ Vec3 ]: The camera's right-vector.
getRotation
sm.camera.getRotation()
Client-Only
Returns the camera's world rotation.
Returns:- [ Quat ]: The camera's rotation.
getUp
sm.camera.getUp()
Client-Only
Returns the up-vector perpendicular to the camera's aim.
Returns:- [ Vec3 ]: The camera's up-vector.
setCameraPullback
sm.camera.setCameraPullback( standing, seated )
Client-Only
Sets the camera's zoom step.
Arguments:standing
[ number ]: How far away the camera is from the player while standing.seated
[ number ]: How far away the camera is from the player while seated.
setCameraState
sm.camera.setCameraState( state )
Client-Only
Sets the camera's control state, see sm.camera.states.
Arguments:state
[ int ]: The camera state.
setDirection
sm.camera.setDirection( dir )
Client-Only
Sets the camera's aim direction.
Arguments:dir
[ Vec3 ]: The direction.
setFov
sm.camera.setFov( fov )
Client-Only
Sets the camera's FOV.
Arguments:fov
[ number ]: The FOV.
setPosition
sm.camera.setPosition( position )
Client-Only
Sets the camera's world position.
Arguments:position
[ Vec3 ]: The position.
setRotation
sm.camera.setRotation( rotation )
Client-Only
Sets the camera's world rotation.
Arguments:rotation
[ Quat ]: The rotation.
setShake
sm.camera.setShake( strength )
Client-Only
Sets the camera's shake level.
Arguments:strength
[ number ]: The shake level.