SceneBoundaryDetails - jimdroberts/FishMMO GitHub Wiki

Description

SceneBoundaryDetails is a serializable class for FishMMO that contains details for a scene boundary, including its origin, size, and logic to check if a point is contained within the boundary. It is used to represent and manage boundary areas in the game world for gameplay and logic checks.


API Access

Fields

  • public Vector3 BoundaryOrigin

    The origin (center) of the boundary in world space.

  • public Vector3 BoundarySize

    The size (width, height, depth) of the boundary.

Methods

  • public bool ContainsPoint(Vector3 point)

    Checks if a given point is contained within the boundary. Parameters: - Vector3 point: The point to check. Returns: bool. True if the point is inside the boundary, false otherwise. No exceptions are thrown.


Basic Usage

Setup

  1. Create a new SceneBoundaryDetails instance and set the BoundaryOrigin and BoundarySize fields as needed.
  2. Use the ContainsPoint method to check if a point is within the boundary.

Example

// Example 1: Creating and configuring a scene boundary
SceneBoundaryDetails details = new SceneBoundaryDetails();
details.BoundaryOrigin = new Vector3(0, 0, 0);
details.BoundarySize = new Vector3(10, 5, 10);

// Example 2: Checking if a point is inside the boundary
Vector3 point = new Vector3(2, 1, 3);
bool isInside = details.ContainsPoint(point);

Best Practices

  • Set both BoundaryOrigin and BoundarySize to accurately define the boundary area.
  • Use ContainsPoint for efficient boundary checks in gameplay logic.
  • Document the intended use and configuration of each boundary for maintainability.
⚠️ **GitHub.com Fallback** ⚠️