CameraSubject (Property): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Outofspace
mNo edit summary
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">"
Tags: mobile web edit mobile edit
 
(46 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{Property|
<onlyinclude>{{Property
name = CameraSubject
|name       = CameraSubject
|property = Object ''Camera subject''
|property   = {{type|instance=Instance}}
|description = Sets what the camera is looking at.
|description = A [[Model]], [[Part]], or [[Humanoid]] for the camera to look at. Setting this property will override the [[Focus]] property.
|object = [[RBX.Lua.Camera|Camera]]
|object     = Camera
|}}
}}</onlyinclude>
{{clear floats}}
 
 
{{Example|In a LocalScript inside the player's character or player's PlayerGui we can do<br/><syntaxhighlight lang="lua">
game.Workspace.CurrentCamera.CameraSubject = game.Workspace.Part
</syntaxhighlight>
 
Makes the player's camera point towards 'Part'.
 
<syntaxhighlight lang="lua">
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
</syntaxhighlight>
 
Reverts the camera to pointing back towards the character.
}}
 
 
==See Also==
*[[Focus]]
*[[CoordinateFrame]]
 
[[Category:Properties]]

Latest revision as of 05:38, 27 April 2023

CameraSubject
Property Instance
Description A Model, Part, or Humanoid for the camera to look at. Setting this property will override the Focus property.
Member of Camera


Example
In a LocalScript inside the player's character or player's PlayerGui we can do
game.Workspace.CurrentCamera.CameraSubject = game.Workspace.Part

Makes the player's camera point towards 'Part'.

game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid

Reverts the camera to pointing back towards the character.


See Also