Package fr.phylisiumstudio.bullet
Class BulletWorldPhysics
java.lang.Object
fr.phylisiumstudio.logic.WorldPhysics
fr.phylisiumstudio.bullet.BulletWorldPhysics
A world physics implementation using bullet physics
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the worldvoid
convertChunk
(javax.vecmath.Vector3f pos1, javax.vecmath.Vector3f pos2) convert region physicscreateBox
(org.bukkit.Location location, org.bukkit.block.data.BlockData blockData, float mass, float xScale, float yScale, float zScale) Create a boxcreateSphere
(org.bukkit.Location location, org.bukkit.block.data.BlockData data, float radius, float mass) Create a sphere@Nullable RigidBlock
Get the block with the given idGet the blocksint
Get Max substepsfloat
Get the time freezeGet the unique id of the world (bukkit world)Get the world nameboolean
isFrozen()
is frozenboolean
Verify if the world can runvoid
removeBlock
(RigidBlock block) Remove a blockvoid
setFreeze
(boolean freeze) set freezevoid
setMaxSubSteps
(int maxSubSteps) Set Max substepsvoid
setTimespan
(float timespan) Set the time freezevoid
Step the simulationMethods inherited from class fr.phylisiumstudio.logic.WorldPhysics
linkRigidBlock
-
Constructor Details
-
BulletWorldPhysics
public BulletWorldPhysics(org.bukkit.World bukkitWorld)
-
-
Method Details
-
stepSimulation
public void stepSimulation()Step the simulation- Specified by:
stepSimulation
in classWorldPhysics
-
getUniqueId
Get the unique id of the world (bukkit world)- Specified by:
getUniqueId
in classWorldPhysics
- Returns:
- the unique id
-
getWorldName
Get the world name- Specified by:
getWorldName
in classWorldPhysics
- Returns:
- the world name
-
getBlocks
Get the blocks- Specified by:
getBlocks
in classWorldPhysics
- Returns:
- the blocks
-
createBox
public RigidBlock createBox(org.bukkit.Location location, org.bukkit.block.data.BlockData blockData, float mass, float xScale, float yScale, float zScale) Create a box- Specified by:
createBox
in classWorldPhysics
- Parameters:
location
- the location (must be in the same world)blockData
- the block data to usemass
- the mass of the blockxScale
- the x scaleyScale
- the y scalezScale
- the z scale- Returns:
- the box
-
createSphere
public RigidBlock createSphere(org.bukkit.Location location, org.bukkit.block.data.BlockData data, float radius, float mass) Create a sphere- Specified by:
createSphere
in classWorldPhysics
- Parameters:
location
- the location (must be in the same world)radius
- the radiusmass
- the mass- Returns:
- the sphere
-
removeBlock
Remove a block- Specified by:
removeBlock
in classWorldPhysics
- Parameters:
block
- the block to remove
-
clear
public void clear()Clear the world- Specified by:
clear
in classWorldPhysics
-
getBlock
Get the block with the given id- Specified by:
getBlock
in classWorldPhysics
- Parameters:
id
- the id- Returns:
- the block
-
convertChunk
public void convertChunk(javax.vecmath.Vector3f pos1, javax.vecmath.Vector3f pos2) Description copied from class:WorldPhysics
convert region physics- Specified by:
convertChunk
in classWorldPhysics
- Parameters:
pos1
- the first positionpos2
- the second position
-
getTimespan
public float getTimespan()Get the time freeze- Specified by:
getTimespan
in classWorldPhysics
-
setTimespan
public void setTimespan(float timespan) Set the time freeze- Specified by:
setTimespan
in classWorldPhysics
- Parameters:
timespan
-
-
getMaxSubSteps
public int getMaxSubSteps()Get Max substeps- Specified by:
getMaxSubSteps
in classWorldPhysics
-
setMaxSubSteps
public void setMaxSubSteps(int maxSubSteps) Set Max substeps- Specified by:
setMaxSubSteps
in classWorldPhysics
- Parameters:
maxSubSteps
-
-
setFreeze
public void setFreeze(boolean freeze) set freeze- Specified by:
setFreeze
in classWorldPhysics
- Parameters:
freeze
- the freeze
-
isFrozen
public boolean isFrozen()is frozen- Specified by:
isFrozen
in classWorldPhysics
- Returns:
- is frozen
-
isRunning
public boolean isRunning()Verify if the world can run- Specified by:
isRunning
in classWorldPhysics
- Returns:
- if the world can run
-