Class SphereCollider

java.lang.Object
net.risingworld.api.collider.Collider
net.risingworld.api.collider.SphereCollider

public class SphereCollider extends Collider
Represents a sphere collider, which has an (optional) offset and a radius
  • Constructor Details

    • SphereCollider

      public SphereCollider(float radius)
      Creates a new sphere collider which is centered to the object.
      Parameters:
      radius - the radius of the sphere.
    • SphereCollider

      public SphereCollider(float x, float y, float z, float radius)
      Creates a new sphere collider.
      Parameters:
      x - optional x offset.
      y - optional y offset.
      z - optional z offset.
      radius - the radius of the sphere.
    • SphereCollider

      public SphereCollider(float x, float y, float z, float radius, boolean isTrigger)
      Creates a new sphere collider.
      Parameters:
      x - optional x offset.
      y - optional y offset.
      z - optional z offset.
      radius - the radius of the sphere.
      isTrigger - if true, this becomes a ghost collider (i.e the player doesn't collide with it, but you can still use it for raycasts).
  • Method Details

    • getCenter

      public Vector3f getCenter()
    • getRadius

      public float getRadius()
    • isTrigger

      public boolean isTrigger()
      Gets whether or not this is a "ghost collider". This means the player won't collide with it (i.e he can simply walk through this collider), but it can still be used for raycasts etc.
      Returns:
      true if this is a ghost collider / trigger collider, false if not.