Signal1
Signal support.
GridMap.swift:1495class Signal1
Use the connect(flags:_:)
method to connect to the signal on the container object, and disconnect(_:)
to drop the connection.
You can also await the emitted
property for waiting for a single emission of the signal.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (39) members.
Type members
static let invalidCellItem: Int
Invalid cell item that can be used in
setCellItem(position:item:orientation:)
to clear cells (or represent an empty cell ingetCellItem(position:)
).class var godotClassName: StringName
Instance members
var cellCenterX: Bool
If
true
, grid items are centered on the X axis.var cellCenterY: Bool
If
true
, grid items are centered on the Y axis.var cellCenterZ: Bool
If
true
, grid items are centered on the Z axis.var cellOctantSize: Int32
The size of each octant measured in number of cells. This applies to all three axis.
var cellScale: Double
The scale of the cell items.
var cellSize: Vector3
The dimensions of the grid’s cells.
var cellSizeChanged: Signal1
Emitted when
cellSize
changes.var changed: SimpleSignal
Emitted when the
MeshLibrary
of this GridMap changes.var collisionLayer: UInt32
The physics layers this GridMap is in.
var collisionMask: UInt32
The physics layers this GridMap detects collisions in. See Collision layers and masks in the documentation for more information.
var collisionPriority: Double
The priority used to solve colliding when occurring penetration. The higher the priority is, the lower the penetration into the object will be. This can for example be used to prevent the player from breaking through the boundaries of a level.
var meshLibrary: MeshLibrary?
The assigned
MeshLibrary
.var physicsMaterial: PhysicsMaterial?
Overrides the default friction and bounce physics properties for the whole
GridMap
.func clear(
) Clear all cells.
func clearBakedMeshes(
) Clears all baked meshes. See
makeBakedMeshes(genLightmapUv:lightmapUvTexelSize:)
.func getBakeMeshInstance(idx: Int32
) -> RID Returns
RID
of a baked mesh with the givenidx
.func getBakeMeshes(
) -> GArray Returns an array of
ArrayMesh
es andTransform3D
references of all bake meshes that exist within the current GridMap.func getBasisWithOrthogonalIndex(Int32
) -> Basis Returns one of 24 possible rotations that lie along the vectors (x,y,z) with each component being either -1, 0, or 1. For further details, refer to the Godot source code.
func getCellItem(position: Vector3i
) -> Int32 The
MeshLibrary
item index located at the given grid coordinates. If the cell is empty,invalidCellItem
will be returned.func getCellItemBasis(position: Vector3i
) -> Basis Returns the basis that gives the specified cell its orientation.
func getCellItemOrientation(position: Vector3i
) -> Int32 The orientation of the cell at the given grid coordinates.
-1
is returned if the cell is empty.func getCollisionLayerValue(layerNumber: Int32
) -> Bool Returns whether or not the specified layer of the
collisionLayer
is enabled, given alayerNumber
between 1 and 32.func getCollisionMaskValue(layerNumber: Int32
) -> Bool Returns whether or not the specified layer of the
collisionMask
is enabled, given alayerNumber
between 1 and 32.func getMeshes(
) -> GArray Returns an array of
Transform3D
andMesh
references corresponding to the non-empty cells in the grid. The transforms are specified in local space.func getOrthogonalIndexFromBasis(Basis
) -> Int32 This function considers a discretization of rotations into 24 points on unit sphere, lying along the vectors (x,y,z) with each component being either -1, 0, or 1, and returns the index (in the range from 0 to 23) of the point best representing the orientation of the object. For further details, refer to the Godot source code.
func getUsedCells(
) -> VariantCollection<Vector3i> Returns an array of
Vector3
with the non-empty cell coordinates in the grid map.func getUsedCellsByItem(Int32
) -> VariantCollection<Vector3i> Returns an array of all cells with the given item index specified in
item
.func localToMap(localPosition: Vector3
) -> Vector3i Returns the map coordinates of the cell containing the given
localPosition
. IflocalPosition
is in global coordinates, consider usingtoLocal(globalPoint:)
before passing it to this method. See alsomapToLocal(mapPosition:)
.func makeBakedMeshes(genLightmapUv: Bool, lightmapUvTexelSize: Double
) Bakes lightmap data for all meshes in the assigned
MeshLibrary
.func mapToLocal(mapPosition: Vector3i
) -> Vector3 Returns the position of a grid cell in the GridMap’s local coordinate space. To convert the returned value into global coordinates, use
toGlobal(localPoint:)
. See alsomapToLocal(mapPosition:)
.func resourceChanged(resource: Resource?
) Obsoleted. Use [signal Resource.changed] instead.
func setCellItem(position: Vector3i, item: Int32, orientation: Int32
) Sets the mesh index for the cell referenced by its grid coordinates.
func setCollisionLayerValue(layerNumber: Int32, value: Bool
) Based on
value
, enables or disables the specified layer in thecollisionLayer
, given alayerNumber
between 1 and 32.func setCollisionMaskValue(layerNumber: Int32, value: Bool
) Based on
value
, enables or disables the specified layer in thecollisionMask
, given alayerNumber
between 1 and 32.
Citizens in SwiftGodot
Instance members
var emitted: Void
You can await this property to wait for the signal to be emitted once
func connect(flags: Object.ConnectFlags, @escaping (_ cellSize: Vector3) -> ()
) -> Object Connects the signal to the specified callback
func disconnect(Object
) Disconnects a signal that was previously connected, the return value from calling
connect(flags:_:)