BNBPhysicsSimulator

Objective-C

@interface BNBPhysicsSimulator : NSObject

/**
 *Sets gravitation vector.
 *@param gravity (vec3): gravity value
 */
- (void)setGravity:(nonnull BNBVec3 *)gravity;

/**
 *Sets damping value.
 *@param damping (float): damping value
 */
- (void)setDamping:(float)damping;

/**
 *Sets inverse bone mass.
 *@param boneName (string): bone name
 *@param value (float): inverse bone mass
 */
- (void)setInvMass:(nonnull NSString *)boneName
             value:(float)value;

/**
 *Add sphere collider.
 *@param sphereIndex (int): index for sphere
 *@param center (vec3): sphere center in world space
 *@param radius (float): sphere radius
 */
- (void)setSphereCollider:(int32_t)sphereIndex
                   center:(nonnull BNBVec3 *)center
                   radius:(float)radius;

/**
 *Add constraint between bone1 and bone2.
 *@param bone1Name (string): from bone name
 *@param bone2Name (string): to bone name
 *@param distance (float): constaint length
 */
- (void)setConstraint:(nonnull NSString *)bone1Name
            bone2Name:(nonnull NSString *)bone2Name
             distance:(float)distance;

/**
 *Sets bonesInMvSpace flag
 *false for legacy effects with special vertex shaders
 *true for using same vertex shaders as for non-physics meshes
 */
- (void)setBonesInMvSpace:(BOOL)bonesInMvSpace;

/**Reset simulator to default state */
- (void)reset;

@end

Swift

class BNBPhysicsSimulator : NSObject

Undocumented

  • Sets gravitation vector.

    Declaration

    Objective-C

    - (void)setGravity:(nonnull BNBVec3 *)gravity;

    Swift

    func setGravity(_ gravity: BNBVec3)

    Parameters

    gravity

    (vec3): gravity value

  • Sets damping value.

    Declaration

    Objective-C

    - (void)setDamping:(float)damping;

    Swift

    func setDamping(_ damping: Float)

    Parameters

    damping

    (float): damping value

  • Sets inverse bone mass.

    Declaration

    Objective-C

    - (void)setInvMass:(nonnull NSString *)boneName value:(float)value;

    Swift

    func setInvMass(_ boneName: String, value: Float)

    Parameters

    boneName

    (string): bone name

    value

    (float): inverse bone mass

  • Add sphere collider.

    Declaration

    Objective-C

    - (void)setSphereCollider:(int32_t)sphereIndex
                       center:(nonnull BNBVec3 *)center
                       radius:(float)radius;

    Swift

    func setSphereCollider(_ sphereIndex: Int32, center: BNBVec3, radius: Float)

    Parameters

    sphereIndex

    (int): index for sphere

    center

    (vec3): sphere center in world space

    radius

    (float): sphere radius

  • Add constraint between bone1 and bone2.

    Declaration

    Objective-C

    - (void)setConstraint:(nonnull NSString *)bone1Name
                bone2Name:(nonnull NSString *)bone2Name
                 distance:(float)distance;

    Swift

    func setConstraint(_ bone1Name: String, bone2Name: String, distance: Float)

    Parameters

    bone1Name

    (string): from bone name

    bone2Name

    (string): to bone name

    distance

    (float): constaint length

  • Sets bonesInMvSpace flag false for legacy effects with special vertex shaders true for using same vertex shaders as for non-physics meshes

    Declaration

    Objective-C

    - (void)setBonesInMvSpace:(BOOL)bonesInMvSpace;

    Swift

    func setBonesInMvSpace(_ bonesInMvSpace: Bool)
  • Reset simulator to default state

    Declaration

    Objective-C

    - (void)reset;

    Swift

    func reset()