Class Area3D

java.lang.Object
net.risingworld.api.worldelements.GameObject
net.risingworld.api.worldelements.Area3D

public class Area3D extends GameObject
A visual representation of an Area.
Example: Create area and display it for the player
1//Create a new area
2Area area = new Area(new Vector3f(-5f, -5f, -5f), new Vector3f(5, 5, 5));
3
4//Create a new Area3D (it visualizes the "Area" object)
5Area3D a = new Area3D(area);
6
7//Set transparent red color (RGBA)
8a.setColor(0xFF000055);
9
10//We don't want the area to be always visible (this is set to true by default)
11a.setAlwaysVisible(false);
12
13//Add the area (which is a game object) to the player (so it becomes visible for him)
14player.addGameObject(a);
  • Constructor Details

    • Area3D

      public Area3D(Area area)
      Creates a new Area3D element which represents an actual Area. Can be used to visualize an Area.
      Note that changes to the Area (i.e if you change its coordinates) requires you to update this Area3D accordingly.
      Parameters:
      area - the Area you want to represent.
  • Method Details

    • setArea

      public void setArea(Area area)
      Sets the underlying Area.
      Parameters:
      area - the new area.
    • getArea

      public Area getArea()
      Gets the underlying Area.
      Returns:
      the area.
    • updateCoordinates

      public void updateCoordinates()
      Updates this element. Call this method if the area coordinates have been changed. Does the same as setArea(getArea());
    • setAlwaysVisible

      public void setAlwaysVisible(boolean set)
      Determines if the element should be always visible (i.e visible through walls etc) or not.
      Parameters:
      set - set to true to make this element always visible.
    • isAlwaysVisible

      public boolean isAlwaysVisible()
      Gets whether this element is always visible (i.e visible through walls etc) or not.
      Returns:
      true if this element is always visible, false if not.
    • setFrameVisible

      public void setFrameVisible(boolean set)
    • isFrameVisible

      public boolean isFrameVisible()
    • setColor

      public void setColor(float r, float g, float b, float a)
      Sets the color (RGBA) of the area (the inner part, not the frame).
      Parameters:
      r - the red color value (0-1)
      g - the green color value (0-1)
      b - the blue color value (0-1)
      a - the alpha value (0-1), 0 makes the area invisible, 1 fully opaque.
    • setColor

      public void setColor(ColorRGBA color)
      Sets the color (RGBA) of the area (the inner part, not the frame).
      Parameters:
      color - the new color
    • setColor

      public void setColor(int color)
    • getColor

      public int getColor()
    • setFrameColor

      public void setFrameColor(float r, float g, float b, float a)
      Sets the color (RGBA) of the frame.
      Parameters:
      r - the red color value (0-1)
      g - the green color value (0-1)
      b - the blue color value (0-1)
      a - the alpha value (0-1), 0 makes the frame invisible, 1 fully opaque.
    • setFrameColor

      public void setFrameColor(ColorRGBA color)
      Sets the color of the frame.
      Parameters:
      color - the new color
    • setFrameColor

      public void setFrameColor(int color)
      Sets the color of the frame.
      Parameters:
      color - the new color as rgba int (e.g 0xFF0000FF)
    • getFrameColor

      public int getFrameColor()