Class: Cursor
Beta
The 3D block cursor is controlled through this read only object and provides the Editor some control over the input methods, display properties and positioning of the 3D block cursor within the world. The 3D block cursor is a native object which is constantly calculating a screen/mouse -> world raycast, and recording the resultant block collision position and facing direction. Depending on the properties of the cursor state, this is not always true – the cursor can also be manually manipulated by keyboard input and moved around independently of mouse movement; when the mouse is moved, the block cursor will return to the mouse/world ray intersection point. The cursor can also be set to either block or face mode; block mode represents the block the mouse is pointing at, and face mode represents the adjacent block that the mouse is pointing at (i.e. the block attached to the face of the intersection point). In practical use, each tool when activated grabs the current cursor state object and stores it. The active tool then sets the current state to represent the functionality of the tool (color, input mode, etc). When the tool loses focus, it restores the cursor state using the stored state object that was grabbed during activation. The 3D block cursor can also be used to query the current block at which the mouse is pointing (or the current block to which the cursor has been manually moved by the user)
Properties
faceDirection
readonlyfaceDirection:number
Beta
Remarks
The face at of the block beneath the 3D block cursor which is intersected by the mouse raycast
Throws
This property can throw when used.
isVisible
readonlyisVisible:boolean
Beta
Remarks
Query whether or not the 3D block cursor is visible or hidden
Throws
This property can throw when used.
maxViewBlockDistance
实验性
readonlymaxViewBlockDistance:number
Beta
Throws
This property can throw when used.
Methods
getDefaultProperties()
getDefaultProperties():
CursorProperties
World Mutation Beta
Returns
Remarks
Throws
This function can throw errors.
getPosition()
getPosition():
Vector3
World Mutation Beta
Returns
Vector3
Remarks
Get the world position of the 3D block cursor
Throws
This function can throw errors.
getProperties()
getProperties():
CursorProperties
World Mutation Beta
Returns
Remarks
Get a property object which represents the current properties of the 3D block cursor.
Throws
This function can throw errors.
getRay()
getRay():
CursorRay
World Mutation Beta
Returns
Remarks
Throws
This function can throw errors.
hide()
hide():
void
World Mutation Beta
Returns
void
Remarks
Hide the 3D block cursor from view until the corresponding Cursor.show function is called
Throws
This function can throw errors.
moveBy()
moveBy(
offset):Vector3
World Mutation Beta
Parameters
offset
Vector3
Amount by which the 3D block cursor should be moved
Returns
Vector3
Return the newly modified position (or previous position if movement was restricted)
Remarks
Manually offset the 3D block cursor by given amount. Depending on the CursorProperties.controlMode - this function may have no effect
Throws
This function can throw errors.
popPropertiesById()
popPropertiesById(
identifier):void
World Mutation Beta
Parameters
identifier
string
Returns
void
Remarks
Throws
This function can throw errors.
pushPropertiesById()
pushPropertiesById(
properties,identifier):void
World Mutation Beta
Parameters
properties
identifier
string
Returns
void
Remarks
Throws
This function can throw errors.
resetToDefaultState()
resetToDefaultState():
void
World Mutation Beta
Returns
void
Remarks
Reset the 3D block cursor to the system default state
Throws
This function can throw errors.
setProperties()
setProperties(
properties):void
World Mutation Beta
Parameters
properties
A set of optional parameters within a property state which represent the intended 3D block cursor state
Returns
void
Remarks
Set the 3D block cursor properties to a given state
Throws
This function can throw errors.
show()
show():
void
World Mutation Beta
Returns
void
Remarks
Make the 3D block cursor visible on screen
Throws
This function can throw errors.
updatePropertiesById()
updatePropertiesById(
properties,identifier?):void
World Mutation Beta
Parameters
properties
identifier?
string
Returns
void
Remarks
Throws
This function can throw errors.
