Module org.dyn4j

Class BodyFixture

    • Constructor Detail

      • BodyFixture

        public BodyFixture​(Convex shape)
        Minimal constructor.
        Parameters:
        shape - the Convex Shape for this fixture
    • Method Detail

      • setDensity

        public void setDensity​(double density)
        Sets the density of this shape in kg/m2.

        The density of an object is a number that represent how much matter is contained in a given space. Larger density values indicate a more massive object. Larger density objects resist changes in motion more than smaller objects.

        Parameters:
        density - the density in kg/m2
        Throws:
        IllegalArgumentException - if density is less than or equal to zero
      • getDensity

        public double getDensity()
        Returns the density of this shape in kg/m2.
        Returns:
        double the density in kg/m2
        See Also:
        setDensity(double)
      • getFriction

        public double getFriction()
        Returns the coefficient of friction.
        Returns:
        double
        See Also:
        setFriction(double)
      • setFriction

        public void setFriction​(double friction)
        Sets the coefficient of friction.

        The coefficient of friction is a number that represents how rough a material is. Friction between surfaces converts the kinetic (motion) energy into heat, thereby slowing the objects in contact down.

        A higher value of friction will slow the object down faster. A friction value of zero represents no friction.

        Parameters:
        friction - the coefficient of friction; must be greater than zero
        Throws:
        IllegalArgumentException - if friction is less than zero
      • getRestitution

        public double getRestitution()
        Returns the coefficient of restitution.
        Returns:
        double
        See Also:
        setRestitution(double)
      • setRestitution

        public void setRestitution​(double restitution)
        Sets the coefficient of restitution.

        The coefficient of restitution is a number that represents the bounciness of a material. Larger values produce more bounce and smaller values produce less bounce. A value of 1.0 indicates that an object would retain all of its velocity after bouncing. The value can be higher than 1 to increase the velocity after bouncing.

        Due to floating point precision and accuracy, a value of 1.0 may not produce a fully ellastic bounce (all the velocity is retained).

        Parameters:
        restitution - the coefficient of restitution; must be greater than zero
        Throws:
        IllegalArgumentException - if restitution is less than zero
      • createMass

        public Mass createMass()
        Creates a new Mass object using the set density and shape.
        Returns:
        Mass