SceneBoundaryDetails - jimdroberts/FishMMO GitHub Wiki
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.
-
public Vector3 BoundaryOrigin
The origin (center) of the boundary in world space.
-
public Vector3 BoundarySize
The size (width, height, depth) of the boundary.
-
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.
- Create a new SceneBoundaryDetails instance and set the BoundaryOrigin and BoundarySize fields as needed.
- Use the ContainsPoint method to check if a point is within the boundary.
// 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);
- 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.