All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.stephengold.joltjni.BodyCreationSettings Maven / Gradle / Ivy

The newest version!
/*
Copyright (c) 2024 Stephen Gold

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
 */
package com.github.stephengold.joltjni;

import com.github.stephengold.joltjni.enumerate.EMotionQuality;
import com.github.stephengold.joltjni.enumerate.EMotionType;
import com.github.stephengold.joltjni.enumerate.EOverrideMassProperties;
import com.github.stephengold.joltjni.readonly.ConstBodyCreationSettings;
import com.github.stephengold.joltjni.readonly.ConstShape;
import com.github.stephengold.joltjni.readonly.QuatArg;
import com.github.stephengold.joltjni.readonly.RVec3Arg;
import com.github.stephengold.joltjni.readonly.Vec3Arg;

/**
 * Settings used to create a rigid body.
 *
 * @author Stephen Gold [email protected]
 */
public class BodyCreationSettings
        extends JoltPhysicsObject
        implements ConstBodyCreationSettings {
    // *************************************************************************
    // constructors

    /**
     * Instantiate default settings.
     */
    public BodyCreationSettings() {
        long bodySettingsVa = createDefault();
        setVirtualAddress(bodySettingsVa, () -> free(bodySettingsVa));
    }

    /**
     * Instantiate settings for the specified shape.
     *
     * @param shape the desired shape (not null)
     * @param loc the desired location (not null, unaffected)
     * @param orient the desired orientation (not null, unaffected)
     * @param motionType the desired motion type (not null)
     * @param objLayer the ID of the desired object layer (≥0)
     */
    public BodyCreationSettings(ConstShape shape, RVec3Arg loc, QuatArg orient,
            EMotionType motionType, int objLayer) {
        long shapeVa = shape.targetVa();
        int motionTypeOrdinal = motionType.ordinal();
        long bodySettingsVa = createFromShape(
                shapeVa, loc.xx(), loc.yy(), loc.zz(),
                orient.getX(), orient.getY(), orient.getZ(), orient.getW(),
                motionTypeOrdinal, objLayer);
        setVirtualAddress(bodySettingsVa, () -> free(bodySettingsVa));
    }

    /**
     * Instantiate with the specified container and native object.
     *
     * @param container the containing object, or {@code null} if none
     * @param bodySettingsVa the virtual address of the native object to assign
     * (not zero)
     */
    BodyCreationSettings(JoltPhysicsObject container, long bodySettingsVa) {
        super(container, bodySettingsVa);
    }

    /**
     * Instantiate settings with the specified native object assigned.
     *
     * @param bodySettingsVa the virtual address of the native object to assign
     * (not zero)
     * @param owner {@code true} → make the JVM object the owner,
     * {@code false} → it isn't the owner
     */
    BodyCreationSettings(long bodySettingsVa, boolean owner) {
        Runnable freeingAction = owner ? () -> free(bodySettingsVa) : null;
        setVirtualAddress(bodySettingsVa, freeingAction);
    }

    /**
     * Instantiate settings for the specified shape reference.
     *
     * @param shapeRef a reference to the desired shape (not null)
     * @param loc the desired location (not null, unaffected)
     * @param orient the desired orientation (not null, unaffected)
     * @param motionType the desired motion type (not null)
     * @param objLayer the ID of the desired object layer
     */
    public BodyCreationSettings(ShapeRef shapeRef, RVec3Arg loc,
            QuatArg orient, EMotionType motionType, int objLayer) {
        this(shapeRef.getPtr(), loc, orient, motionType, objLayer);
    }

    /**
     * Instantiate settings for the specified shape reference.
     *
     * @param shapeRef a reference to the desired shape (not null)
     * @param loc the desired location (not null, unaffected)
     * @param orient the desired orientation (not null, unaffected)
     * @param motionType the desired motion type (not null)
     * @param objLayer the ID of the desired object layer
     */
    public BodyCreationSettings(ShapeRefC shapeRef, RVec3Arg loc,
            QuatArg orient, EMotionType motionType, int objLayer) {
        this(shapeRef.getPtr(), loc, orient, motionType, objLayer);
    }

    /**
     * Instantiate settings for the specified shape settings.
     *
     * @param shapeSettings the desired shape settings (not null)
     * @param loc the desired location (not null, unaffected)
     * @param orient the desired orientation (not null, unaffected)
     * @param motionType the desired motion type (not null)
     * @param objLayer the ID of the desired object layer
     */
    public BodyCreationSettings(ShapeSettings shapeSettings, RVec3Arg loc,
            QuatArg orient, EMotionType motionType, int objLayer) {
        long shapeSettingsVa = shapeSettings.va();
        int motionTypeOrdinal = motionType.ordinal();
        long bodySettingsVa = createFromShapeSettings(
                shapeSettingsVa, loc.xx(), loc.yy(), loc.zz(),
                orient.getX(), orient.getY(), orient.getZ(), orient.getW(),
                motionTypeOrdinal, objLayer);
        setVirtualAddress(bodySettingsVa, () -> free(bodySettingsVa));
    }

    /**
     * Instantiate settings for the specified shape-settings reference.
     *
     * @param shapeSettingsRef a reference to the desired shape settings (not
     * null)
     * @param loc the desired location (not null, unaffected)
     * @param orient the desired orientation (not null, unaffected)
     * @param motionType the desired motion type (not null)
     * @param objLayer the ID of the desired object layer
     */
    public BodyCreationSettings(ShapeSettingsRef shapeSettingsRef, RVec3Arg loc,
            QuatArg orient, EMotionType motionType, int objLayer) {
        this(shapeSettingsRef.getPtr(), loc, orient, motionType, objLayer);
    }
    // *************************************************************************
    // new methods exposed

    /**
     * Access the collision group.
     *
     * @return a new JVM object with the pre-existing native object assigned
     */
    public CollisionGroup getCollisionGroup() {
        long bodySettingsVa = va();
        long groupVa = getCollisionGroup(bodySettingsVa);
        CollisionGroup result = new CollisionGroup(this, groupVa);

        return result;
    }

    /**
     * Alter whether the created body will be allowed to fall asleep. (native
     * attribute: mAllowSleeping)
     *
     * @param allow {@code true} to allow, {@code false} to inhibit
     * (default=true)
     */
    public void setAllowSleeping(boolean allow) {
        long bodySettingsVa = va();
        setAllowSleeping(bodySettingsVa, allow);
    }

    /**
     * Alter the angular damping constant. (native attribute: mAngularDamping)
     *
     * @param damping the desired value (in units of per second, ≥0, ≤1,
     * default=0.05)
     */
    public void setAngularDamping(float damping) {
        long bodySettingsVa = va();
        setAngularDamping(bodySettingsVa, damping);
    }

    /**
     * Alter the (initial) angular velocity. (native attribute:
     * mAngularVelocity)
     *
     * @param omega the desired angular velocity (radians per second in
     * physics-system coordinates, not null, unaffected, default=(0,0,0))
     */
    public void setAngularVelocity(Vec3Arg omega) {
        long bodySettingsVa = va();
        setAngularVelocity(bodySettingsVa,
                omega.getX(), omega.getY(), omega.getZ());
    }

    /**
     * Alter the collision group to which the body will belong. (native
     * attribute: mCollisionGroup)
     *
     * @param group the desired group (not null, unaffected)
     */
    public void setCollisionGroup(CollisionGroup group) {
        long bodySettingsVa = va();
        long groupVa = group.va();
        setCollisionGroup(bodySettingsVa, groupVa);
    }

    /**
     * Alter whether extra effort should be made to remove ghost contacts.
     *
     * @param enhance {@code true} for extra effort, {@code false} for ordinary
     * effort (default=false)
     */
    public void setEnhancedInternalEdgeRemoval(boolean enhance) {
        long bodySettingsVa = va();
        setEnhancedInternalEdgeRemoval(bodySettingsVa, enhance);
    }

    /**
     * Alter the friction ratio. (native attribute: mFriction)
     *
     * @param friction the desired ratio (typically ≥0 and ≤1,
     * default=0.2)
     */
    public void setFriction(float friction) {
        long bodySettingsVa = va();
        setFriction(bodySettingsVa, friction);
    }

    /**
     * Alter the gravity multiplier. (native attribute: mGravityFactor)
     *
     * @param factor the desired multiplier (default=1)
     */
    public void setGravityFactor(float factor) {
        long bodySettingsVa = va();
        setGravityFactor(bodySettingsVa, factor);
    }

    /**
     * Alter whether the body will be a sensor. (native attribute: mIsSensor)
     *
     * @param setting {@code true} for a sensor, otherwise {@code false}
     * (default=false)
     */
    public void setIsSensor(boolean setting) {
        long bodySettingsVa = va();
        setIsSensor(bodySettingsVa, setting);
    }

    /**
     * Alter the linear damping constant. (native attribute: mLinearDamping)
     *
     * @param damping the desired value (in units of per second, ≥0, ≤1,
     * default=0.05)
     */
    public void setLinearDamping(float damping) {
        long bodySettingsVa = va();
        setLinearDamping(bodySettingsVa, damping);
    }

    /**
     * Alter the (initial) linear velocity. (native attribute: mLinearVelocity)
     *
     * @param velocity the desired velocity (in physics-system coordinates, not
     * null, unaffected, default=(0,0,0))
     */
    public void setLinearVelocity(Vec3Arg velocity) {
        long bodySettingsVa = va();
        setLinearVelocity(bodySettingsVa,
                velocity.getX(), velocity.getY(), velocity.getZ());
    }

    /**
     * Alter the mass-properties override. (native attribute:
     * mMassPropertiesOverride)
     *
     * @param properties the desired properties (not null, unaffected)
     */
    public void setMassPropertiesOverride(MassProperties properties) {
        long bodySettingsVa = va();
        long propertiesVa = properties.va();
        setMassPropertiesOverride(bodySettingsVa, propertiesVa);
    }

    /**
     * Alter the maximum angular speed. (native attribute: mMaxAngularVelocity)
     *
     * @param maxSpeed the desired maximum speed (in radians per second, ≥0,
     * default=15*pi)
     */
    public void setMaxAngularVelocity(float maxSpeed) {
        long bodySettingsVa = va();
        setMaxAngularVelocity(bodySettingsVa, maxSpeed);
    }

    /**
     * Alter the maximum linear speed. (native attribute: mMaxLinearVelocity)
     *
     * @param maxSpeed the desired maximum speed (in meters per second, ≥0,
     * default=500)
     */
    public void setMaxLinearVelocity(float maxSpeed) {
        long bodySettingsVa = va();
        setMaxLinearVelocity(bodySettingsVa, maxSpeed);
    }

    /**
     * Alter the motion quality. (native attribute: mMotionQuality)
     *
     * @param motionQuality the desired quality (not null, default=Discrete)
     */
    public void setMotionQuality(EMotionQuality motionQuality) {
        long bodySettingsVa = va();
        int motionQualityOrdinal = motionQuality.ordinal();
        setMotionQuality(bodySettingsVa, motionQualityOrdinal);
    }

    /**
     * Alter the motion type. (native attribute: mMotionType)
     *
     * @param motionType the desired type (not null, default=Dynamic)
     */
    public void setMotionType(EMotionType motionType) {
        long bodySettingsVa = va();
        int motionTypeOrdinal = motionType.ordinal();
        setMotionType(bodySettingsVa, motionTypeOrdinal);
    }

    /**
     * Alter the object layer. (native attribute: mObjectLayer)
     *
     * @param objLayer the ID of the desired object layer (≥0,
     * <numObjectLayers, default=0)
     */
    public void setObjectLayer(int objLayer) {
        long bodySettingsVa = va();
        setObjectLayer(bodySettingsVa, objLayer);
    }

    /**
     * Alter how the mass-properties override will be used. (native attribute:
     * mOverrideMassProperties)
     *
     * @param setting an enum value (not null, default=CalculateMassAndInertia)
     */
    public void setOverrideMassProperties(EOverrideMassProperties setting) {
        long bodySettingsVa = va();
        int ordinal = setting.ordinal();
        setOverrideMassProperties(bodySettingsVa, ordinal);
    }

    /**
     * Alter the (initial) location of the body's origin (which might not
     * coincide with its center of mass). (native attribute: mPosition)
     *
     * @param location the desired location (in physics-system coordinates, not
     * null, unaffected, default=(0,0,0))
     */
    public void setPosition(RVec3Arg location) {
        long bodySettingsVa = va();
        double xx = location.xx();
        double yy = location.yy();
        double zz = location.zz();
        setPosition(bodySettingsVa, xx, yy, zz);
    }

    /**
     * Alter the restitution ratio for collisions. (native attribute:
     * mRestitution)
     *
     * @param restitution the desired ratio (typically ≥0 and ≤1,
     * default=0)
     */
    public void setRestitution(float restitution) {
        long bodySettingsVa = va();
        setRestitution(bodySettingsVa, restitution);
    }

    /**
     * Alter the (initial) orientation of the body's axes. (native attribute:
     * mRotation)
     *
     * @param quat the desired rotation (relative to the physics-system axes,
     * not null, unaffected, default=(0,0,0,1))
     */
    public void setRotation(QuatArg quat) {
        long bodySettingsVa = va();
        float qw = quat.getW();
        float qx = quat.getX();
        float qy = quat.getY();
        float qz = quat.getZ();
        setRotation(bodySettingsVa, qx, qy, qz, qw);
    }

    /**
     * Replace the shape.
     *
     * @param shape the desired shape (not null, unaffected)
     */
    public void setShape(ConstShape shape) {
        long bodySettingsVa = va();
        long shapeVa = shape.targetVa();
        setShape(bodySettingsVa, shapeVa);
    }

    /**
     * Replace the shape.
     *
     * @param shapeRef a reference to the desired shape (not null)
     */
    public void setShape(ShapeRefC shapeRef) {
        ConstShape shape = shapeRef.getPtr();
        setShape(shape);
    }

    /**
     * Replace the shape settings.
     *
     * @param shapeSettings the desired shape settings (not null)
     */
    public void setShapeSettings(ShapeSettings shapeSettings) {
        long bodySettingsVa = va();
        long shapeSettingsVa = shapeSettings.va();
        setShapeSettings(bodySettingsVa, shapeSettingsVa);
    }

    /**
     * Replace the shape settings.
     *
     * @param shapeSettingsRef a reference to the desired shape settings (not
     * null)
     */
    public void setShapeSettings(ShapeSettingsRef shapeSettingsRef) {
        ShapeSettings shapeSettings = shapeSettingsRef.getPtr();
        setShapeSettings(shapeSettings);
    }
    // *************************************************************************
    // ConstBodyCreationSettings methods

    /**
     * Test whether the created body will be allowed to fall asleep. The
     * settings are unaffected. (native attribute: mAllowSleeping)
     *
     * @return {@code true} if allowed, otherwise {@code false}
     */
    @Override
    public boolean getAllowSleeping() {
        long bodySettingsVa = va();
        boolean result = getAllowSleeping(bodySettingsVa);

        return result;
    }

    /**
     * Return the angular damping constant. The settings are unaffected. (native
     * attribute: mAngularDamping)
     *
     * @return the constant (in units of per second, ≥0, ≤1)
     */
    @Override
    public float getAngularDamping() {
        long bodySettingsVa = va();
        float result = getAngularDamping(bodySettingsVa);

        return result;
    }

    /**
     * Copy the (initial) angular velocity. The settings are unaffected. (native
     * attribute: mAngularVelocity)
     *
     * @return a new velocity vector (radians per second in physics-system
     * coordinates)
     */
    @Override
    public Vec3 getAngularVelocity() {
        long bodySettingsVa = va();
        float vx = getAngularVelocityX(bodySettingsVa);
        float vy = getAngularVelocityY(bodySettingsVa);
        float vz = getAngularVelocityZ(bodySettingsVa);
        Vec3 result = new Vec3(vx, vy, vz);

        return result;
    }

    /**
     * Test whether extra effort should be made to remove ghost contacts.
     *
     * @return {@code true} for extra effort, otherwise {@code false}
     */
    @Override
    public boolean getEnhancedInternalEdgeRemoval() {
        long bodySettingsVa = va();
        boolean result = getEnhancedInternalEdgeRemoval(bodySettingsVa);

        return result;
    }

    /**
     * Return the friction ratio. The settings are unaffected. (native
     * attribute: mFriction)
     *
     * @return the ratio (typically ≥0 and ≤1)
     */
    @Override
    public float getFriction() {
        long bodySettingsVa = va();
        float result = getFriction(bodySettingsVa);

        return result;
    }

    /**
     * Return the gravity factor. The settings are unaffected. (native
     * attribute: mGravityFactor)
     *
     * @return the factor
     */
    @Override
    public float getGravityFactor() {
        long bodySettingsVa = va();
        float result = getGravityFactor(bodySettingsVa);

        return result;
    }

    /**
     * Test whether the body will be a sensor. The settings are unaffected.
     * (native attribute: mIsSensor)
     *
     * @return {@code true} for a sensor, otherwise {@code false}
     */
    @Override
    public boolean getIsSensor() {
        long bodySettingsVa = va();
        boolean result = getIsSensor(bodySettingsVa);

        return result;
    }

    /**
     * Return the linear damping constant. The settings are unaffected. (native
     * attribute: mLinearDamping)
     *
     * @return the constant (in units of per second, ≥0, ≤1)
     */
    @Override
    public float getLinearDamping() {
        long bodySettingsVa = va();
        float result = getLinearDamping(bodySettingsVa);

        return result;
    }

    /**
     * Copy the (initial) linear velocity. The settings are unaffected. (native
     * attribute: mLinearVelocity)
     *
     * @return a new velocity vector (meters per second in physics-system
     * coordinates)
     */
    @Override
    public Vec3 getLinearVelocity() {
        long bodySettingsVa = va();
        float vx = getLinearVelocityX(bodySettingsVa);
        float vy = getLinearVelocityY(bodySettingsVa);
        float vz = getLinearVelocityZ(bodySettingsVa);
        Vec3 result = new Vec3(vx, vy, vz);

        return result;
    }

    /**
     * Calculate the mass and inertia. The settings are unaffected.
     *
     * @return a new JVM object with a new native object assigned
     */
    @Override
    public MassProperties getMassProperties() {
        long bodySettingsVa = va();
        long propertiesVa = getMassProperties(bodySettingsVa);
        MassProperties result = new MassProperties(propertiesVa, true);

        return result;
    }

    /**
     * Access the mass-properties override. (native attribute:
     * mMassPropertiesOverride)
     *
     * @return a new JVM object with the pre-existing native object assigned
     */
    @Override
    public MassProperties getMassPropertiesOverride() {
        long bodySettingsVa = va();
        long propertiesVa = getMassPropertiesOverride(bodySettingsVa);
        MassProperties result = new MassProperties(this, propertiesVa);

        return result;
    }

    /**
     * Return the maximum angular speed. The settings are unaffected. (native
     * attribute: mMaxAngularVelocity)
     *
     * @return the maximum speed (in radians per second)
     */
    @Override
    public float getMaxAngularVelocity() {
        long bodySettingsVa = va();
        float result = getMaxAngularVelocity(bodySettingsVa);

        return result;
    }

    /**
     * Return the maximum linear speed. The settings are unaffected. (native
     * attribute: mMaxLinearVelocity)
     *
     * @return the maximum speed (in meters per second)
     */
    @Override
    public float getMaxLinearVelocity() {
        long bodySettingsVa = va();
        float result = getMaxLinearVelocity(bodySettingsVa);

        return result;
    }

    /**
     * Return the motion quality. The settings are unaffected. (native
     * attribute: mMotionQuality)
     *
     * @return an enum value (not null)
     */
    @Override
    public EMotionQuality getMotionQuality() {
        long bodySettingsVa = va();
        int ordinal = getMotionQuality(bodySettingsVa);
        EMotionQuality result = EMotionQuality.values()[ordinal];

        return result;
    }

    /**
     * Return the motion type. The settings are unaffected. (native attribute:
     * mMotionType)
     *
     * @return an enum value (not null)
     */
    @Override
    public EMotionType getMotionType() {
        long bodySettingsVa = va();
        int ordinal = getMotionType(bodySettingsVa);
        EMotionType result = EMotionType.values()[ordinal];

        return result;
    }

    /**
     * Return the index of the object layer. The settings are unaffected.
     * (native attribute: mObjectLayer)
     *
     * @return the layer index (≥0, <numObjectLayers)
     */
    @Override
    public int getObjectLayer() {
        long bodySettingsVa = va();
        int result = getObjectLayer(bodySettingsVa);

        return result;
    }

    /**
     * Return how the mass-properties override will be used. The settings are
     * unaffected. (native attribute: mOverrideMassProperties)
     *
     * @return an enum value (not null)
     */
    @Override
    public EOverrideMassProperties getOverrideMassProperties() {
        long bodySettingsVa = va();
        int ordinal = getOverrideMassProperties(bodySettingsVa);
        EOverrideMassProperties result
                = EOverrideMassProperties.values()[ordinal];
        return result;
    }

    /**
     * Return the (initial) location. The settings are unaffected. (native
     * attribute: mPosition)
     *
     * @return a new location vector (in physics-system coordinates, all
     * components finite)
     */
    @Override
    public RVec3 getPosition() {
        long bodySettingsVa = va();

        double xx = getPositionX(bodySettingsVa);
        assert Double.isFinite(xx) : "xx = " + xx;

        double yy = getPositionY(bodySettingsVa);
        assert Double.isFinite(yy) : "yy = " + yy;

        double zz = getPositionZ(bodySettingsVa);
        assert Double.isFinite(zz) : "zz = " + zz;

        RVec3 result = new RVec3(xx, yy, zz);
        return result;
    }

    /**
     * Return the restitution ratio. The settings are unaffected. (native
     * attribute: mRestitution)
     *
     * @return the ratio (typically ≥0 and ≤1)
     */
    @Override
    public float getRestitution() {
        long bodySettingsVa = va();
        float result = getRestitution(bodySettingsVa);

        return result;
    }

    /**
     * Copy the (initial) orientation of the body's axes. The settings are
     * unaffected. (native attribute: mRotation)
     *
     * @return a new rotation quaternion (relative to the physics-system axes)
     */
    @Override
    public Quat getRotation() {
        long bodySettingsVa = va();
        float qw = getRotationW(bodySettingsVa);
        float qx = getRotationX(bodySettingsVa);
        float qy = getRotationY(bodySettingsVa);
        float qz = getRotationZ(bodySettingsVa);
        Quat result = new Quat(qx, qy, qz, qw);

        return result;
    }

    /**
     * Acquire read-only access to the {@code Shape}. The settings are
     * unaffected.
     *
     * @return a new JVM object with the pre-existing native object assigned, or
     * {@code null}
     */
    @Override
    public ConstShape getShape() {
        long bodySettingsVa = va();
        long shapeSettingsVa = getShape(bodySettingsVa);
        ConstShape result = Shape.newShape(shapeSettingsVa);

        return result;
    }

    /**
     * Test whether the body's mass properties will be calculated. The settings
     * are unaffected.
     *
     * @return {@code true} if calculated, otherwise {@code false}
     */
    @Override
    public boolean hasMassProperties() {
        long bodySettingsVa = va();
        boolean result = hasMassProperties(bodySettingsVa);
        return result;
    }
    // *************************************************************************
    // native private methods

    native private static long createDefault();

    native private static long createFromShape(
            long shapeVa, double locX, double locY, double locZ,
            float qx, float qy, float qz, float qw,
            int motionTypeOrdinal, int objLayer);

    native private static long createFromShapeSettings(
            long shapeSettingsVa, double locX, double locY, double locZ,
            float qx, float qy, float qz, float qw,
            int motionTypeOrdinal, int objLayer);

    native private static void free(long bodySettingsVa);

    native private static boolean getAllowSleeping(long bodySettingsVa);

    native private static float getAngularDamping(long bodySettingsVa);

    native private static float getAngularVelocityX(long bodySettingsVa);

    native private static float getAngularVelocityY(long bodySettingsVa);

    native private static float getAngularVelocityZ(long bodySettingsVa);

    native private static long getCollisionGroup(long bodySettingsVa);

    native private static boolean getEnhancedInternalEdgeRemoval(
            long bodySettingsVa);

    native private static float getFriction(long bodySettingsVa);

    native private static float getGravityFactor(long bodySettingsVa);

    native private static boolean getIsSensor(long bodySettingsVa);

    native private static float getLinearDamping(long bodySettingsVa);

    native private static float getLinearVelocityX(long bodySettingsVa);

    native private static float getLinearVelocityY(long bodySettingsVa);

    native private static float getLinearVelocityZ(long bodySettingsVa);

    native private static long getMassProperties(long bodySettingsVa);

    native private static long getMassPropertiesOverride(long bodySettingsVa);

    native private static float getMaxAngularVelocity(long bodySettingsVa);

    native private static float getMaxLinearVelocity(long bodySettingsVa);

    native private static int getMotionQuality(long bodySettingsVa);

    native private static int getMotionType(long bodySettingsVa);

    native private static int getObjectLayer(long bodySettingsVa);

    native private static int getOverrideMassProperties(long bodySettingsVa);

    native private static double getPositionX(long bodySettingsVa);

    native private static double getPositionY(long bodySettingsVa);

    native private static double getPositionZ(long bodySettingsVa);

    native private static float getRestitution(long bodySettingsVa);

    native private static float getRotationW(long bodySettingsVa);

    native private static float getRotationX(long bodySettingsVa);

    native private static float getRotationY(long bodySettingsVa);

    native private static float getRotationZ(long bodySettingsVa);

    native private static long getShape(long bodySettingsVa);

    native private static boolean hasMassProperties(long bodySettingsVa);

    native private static void setAllowSleeping(
            long bodySettingsVa, boolean allow);

    native private static void setAngularDamping(
            long bodySettingsVa, float damping);

    native private static void setAngularVelocity(
            long bodySettingsVa, float wx, float wy, float wz);

    native private static void setCollisionGroup(
            long bodySettingsVa, long groupVa);

    native private static void setEnhancedInternalEdgeRemoval(
            long bodySettingsVa, boolean enhance);

    native private static void setFriction(long bodySettingsVa, float friction);

    native private static void setGravityFactor(
            long bodySettingsVa, float factor);

    native private static void setIsSensor(
            long bodySettingsVa, boolean setting);

    native private static void setLinearDamping(
            long bodySettingsVa, float damping);

    native private static void setLinearVelocity(
            long bodySettingsVa, float vx, float vy, float vz);

    native private static void setMassPropertiesOverride(
            long bodySettingsVa, long propertiesVa);

    native private static void setMaxAngularVelocity(
            long bodySettingsVa, float maxSpeed);

    native private static void setMaxLinearVelocity(
            long bodySettingsVa, float maxSpeed);

    native private static void setMotionQuality(
            long bodySettingsVa, int motionQualityOrdinal);

    native private static void setMotionType(
            long bodySettingsVa, int motionTypeOrdinal);

    native private static void setObjectLayer(
            long bodySettingsVa, int objLayer);

    native private static void setOverrideMassProperties(
            long bodySettingsVa, int ordinal);

    native private static void setPosition(
            long bodySettingsVa, double locX, double locY, double locZ);

    native private static void setRestitution(
            long bodySettingsVa, float restitution);

    native private static void setRotation(
            long bodySettingsVa, float qx, float qy, float qz, float qw);

    native private static void setShape(long bodySettingsVa, long shapeVa);

    native private static void setShapeSettings(
            long bodySettingsVa, long shapeSettingsVa);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy