Package net.risingworld.api.collider
Class SphereCollider
java.lang.Object
net.risingworld.api.collider.Collider
net.risingworld.api.collider.SphereCollider
Represents a sphere collider, which has an (optional) offset and a radius
-
Nested Class Summary
Nested classes/interfaces inherited from class net.risingworld.api.collider.Collider
Collider.Type
-
Constructor Summary
ConstructorDescriptionSphereCollider
(float radius) Creates a new sphere collider which is centered to the object.SphereCollider
(float x, float y, float z, float radius) Creates a new sphere collider.SphereCollider
(float x, float y, float z, float radius, boolean isTrigger) Creates a new sphere collider. -
Method Summary
-
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
-
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.
-