Class HeightFieldShapeSettings

All Implemented Interfaces:
ConstJoltPhysicsObject, ConstShapeSettings, RefTarget, AutoCloseable, Comparable<JoltPhysicsObject>

public class HeightFieldShapeSettings extends ShapeSettings
Settings used to construct a HeightFieldShape.
  • Constructor Details

    • HeightFieldShapeSettings

      public HeightFieldShapeSettings(float[] samples, Vec3Arg offset, Vec3Arg scale, int sampleCount)
      Instantiate settings for the specified samples.
      Parameters:
      samples - array of height values (not null, length≥4, unaffected)
      offset - (not null, unaffected)
      scale - (not null, unaffected)
      sampleCount - the number of height values along each edge (≥2*blockSize)
    • HeightFieldShapeSettings

      public HeightFieldShapeSettings(float[] samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices)
      Instantiate settings for the specified samples.
      Parameters:
      samples - array of height values (not null, length≥4, unaffected)
      offset - (not null, unaffected)
      scale - (not null, unaffected)
      sampleCount - the number of height values along each edge (≥2*blockSize)
      materialIndices - a material index for each sample (default=null)
    • HeightFieldShapeSettings

      public HeightFieldShapeSettings(float[] samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices, PhysicsMaterialList materialList)
      Instantiate settings for the specified samples.
      Parameters:
      samples - array of height values (not null, length≥4, unaffected)
      offset - (not null, unaffected)
      scale - (not null, unaffected)
      sampleCount - the number of height values along each edge (≥2*blockSize)
      materialIndices - a material index for each sample (default=null)
      materialList - the list of materials
    • HeightFieldShapeSettings

      public HeightFieldShapeSettings(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount)
      Instantiate settings for the specified samples.
      Parameters:
      samples - array of height values (not null, capacity≥4, unaffected)
      offset - (not null, unaffected)
      scale - (not null, unaffected)
      sampleCount - the number of height values along each edge (≥2*blockSize)
    • HeightFieldShapeSettings

      public HeightFieldShapeSettings(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices)
      Instantiate settings for the specified samples.
      Parameters:
      samples - array of height values (not null, capacity≥4, unaffected)
      offset - (not null, unaffected)
      scale - (not null, unaffected)
      sampleCount - the number of height values along each edge (≥2*blockSize)
      materialIndices - a material index for each sample (default=null)
    • HeightFieldShapeSettings

      public HeightFieldShapeSettings(FloatBuffer samples, Vec3Arg offset, Vec3Arg scale, int sampleCount, byte[] materialIndices, PhysicsMaterialList materialList)
      Instantiate settings for the specified samples.
      Parameters:
      samples - array of height values (not null, capacity≥4, unaffected)
      offset - (not null, unaffected)
      scale - (not null, unaffected)
      sampleCount - the number of height values along each edge (≥2*blockSize)
      materialIndices - a material index for each sample (default=null)
      materialList - the list of materials
  • Method Details

    • getActiveEdgeCosThresholdAngle

      public float getActiveEdgeCosThresholdAngle()
      Return the cosine of the active-edge threshold angle. The settings are unaffected. (native attribute: mActiveEdgeCosThresholdAngle)
      Returns:
      the cosine
    • getBitsPerSample

      public int getBitsPerSample()
      Return the number of bits per sample to use during compression. The settings are unaffected. (native attribute: mBitsPerSample)
      Returns:
      the number of bits (≥1, ≤8)
    • getBlockSize

      public int getBlockSize()
      Return the block size. The settings are unaffected. (native attribute: mBlockSize)

      For culling purposes, the height field is organized in blocks of 2 * mBlockSize * mBlockSize triangles.

      Sensible values range from 2 to 8.

      Returns:
      the block size (in rows)
    • getMaxHeightValue

      public float getMaxHeightValue()
      Return the artificial maximum height. The settings are unaffected. (native attribute: mMaxHeightValue)
      Returns:
      the height value
    • getMinHeightValue

      public float getMinHeightValue()
      Return the artificial minimum height. The settings are unaffected. (native attribute: mMinHeightValue)
      Returns:
      the height value
    • getOffset

      public Vec3 getOffset()
      Copy the offset of the first sample. The settings are unaffected. (native attribute: mOffset)
      Returns:
      a new offset vector
    • getSampleCount

      public int getSampleCount()
      Count the samples. The settings are unaffected. (native attribute: mSampleCount)
      Returns:
      the number of samples (≥0)
    • getScale

      public Vec3 getScale()
      Copy the scale factors. The settings are unaffected. (native attribute: mScale)
      Returns:
      a new scaling vector
    • setActiveEdgeCosThresholdAngle

      public void setActiveEdgeCosThresholdAngle(float cosine)
      Alter the active-edge threshold angle. (native attribute: mActiveEdgeCosThresholdAngle)
      Parameters:
      cosine - the cosine of the desired angle (default=0.996195)
    • setBitsPerSample

      public void setBitsPerSample(int numBits)
      Alter the number of bits per sample to use during compression. (native attribute: mBitsPerSample)
      Parameters:
      numBits - the number of bits (≥1, ≤8, default=8)
    • setBlockSize

      public void setBlockSize(int numRows)
      Alter the block size. (native attribute: mBlockSize)

      For culling purposes, the height field is organized in blocks of 2 * mBlockSize * mBlockSize triangles.

      Sensible values range from 2 to 8.

      Parameters:
      numRows - the desired block size (in rows, default=2)
    • setMaxHeightValue

      public void setMaxHeightValue(float maxHeight)
      Alter the artificial maximum height. (native attribute: mMaxHeightValue)
      Parameters:
      maxHeight - the desired height value (default=-1e15)
    • setMinHeightValue

      public void setMinHeightValue(float minHeight)
      Alter the artificial minimum height. (native attribute: mMinHeightValue)
      Parameters:
      minHeight - the desired height value (default=1e15)
    • setOffset

      public void setOffset(Vec3Arg offset)
      Alter the offset of the first sample. (native attribute: mOffset)
      Parameters:
      offset - the desired offset vector (not null, unaffected, default=(0,0,0))
    • setScale

      public void setScale(Vec3Arg scale)
      Alter the scale factors. (native attribute: mScale)
      Parameters:
      scale - the desired scale factors (not null, unaffected, default=(1,1,1))