16 public int Row {
get;
private set; }
21 public int Column {
get;
private set; }
43 CollisionMask = collisionMask,
47 var shape =
new BoxShape3D() { Size = room.
CellSize };
48 var collisionShape =
new CollisionShape3D() { Shape = shape };
49 cell.AddChild(collisionShape);
54 public override void _Ready()
57 BodyEntered += OnBodyEntered;
58 AreaEntered += OnAreaEntered;
59 BodyExited += OnBodyExited;
60 AreaExited += OnAreaExited;
63 private void OnBodyEntered(Node body)
65 EmitOnCellEntered(body);
68 private void OnAreaEntered(Area3D area)
70 EmitOnCellEntered(area);
73 private void OnBodyExited(Node body)
75 EmitOnCellExited(body);
78 private void OnAreaExited(Area3D area)
80 EmitOnCellExited(area);
83 private void EmitOnCellEntered(Node collision)
86 Room.EmitOnCellAreaEntered(
this, collision);
89 private void EmitOnCellExited(Node collision)
91 Room.EmitOnCellAreaExited(
this, collision);
Provides area and body entering and exiting detection for a cell.
RoomNode3D Room
The containing room.
int Row
The cell row in the room.
static CellArea3D CreateInstance(int row, int column, RoomNode3D room, uint collisionMask)
Creates a new instance with child collision shape and adds it as a child of the specified room.
int Column
The cell column in the room.
A node serving as the top level of a 3D room.
Vector3 CellCenterLocalPosition(int row, int column)
Returns the cell center local position for the specified cell index.
Vector3 CellSize
The width and height of the room cells.