Enfusion Script API
Loading...
Searching...
No Matches
PhysicsJoint Interface Reference

Wrapper over joint simulation. More...

Inheritance diagram for PhysicsJoint:
global_pointer pointer Physics6DOFJoint PhysicsBallSocketJoint PhysicsConeTwistJoint PhysicsFixedJoint PhysicsHingeJoint PhysicsSliderJoint Physics6DOFSpringJoint

Public Member Functions

proto external void Destroy ()
 Destroys joint.
 
- Public Member Functions inherited from pointer
proto string ToString ()
 

Static Public Member Functions

static proto PhysicsHingeJoint CreateHinge (notnull IEntity ent1, IEntity ent2, vector point1, vector axis1, vector point2, vector axis2, bool disableCollisions, float breakThreshold=-1)
 Creates hinge joint.
 
static proto PhysicsHingeJoint CreateHinge2 (notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
 Creates hinge joint.
 
static proto PhysicsBallSocketJoint CreateBallSocket (notnull IEntity ent1, IEntity ent2, vector point1, vector point2, bool disableCollisions, float breakThreshold=-1)
 Creates ball socket joint.
 
static proto PhysicsFixedJoint CreateFixed (notnull IEntity ent1, IEntity ent2, vector point1, vector point2, bool disableCollisions, float breakThreshold=-1)
 Creates fixed joint.
 
static proto PhysicsConeTwistJoint CreateConeTwist (notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
 Creates cone twist joint.
 
static proto PhysicsSliderJoint CreateSlider (notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
 Creates slider joint.
 
static proto Physics6DOFJoint Create6DOF (notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
 Creates 6 DOF joint.
 
static proto Physics6DOFSpringJoint Create6DOFSpring (notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
 Creates DOF spring joint.
 

Detailed Description

Wrapper over joint simulation.

Joint parameters

  • softness
    • 0->1, recommend ~0.8->1
    • describes % of limits where movement is free
    • beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached
  • biasFactor
    • 0->1?, recommend 0.3 +/-0.3 or so
    • strength with which constraint resists zeroth order (angular, not angular velocity) limit violation
  • relaxationFactor
    • 0->1, recommend to stay near 1
    • the lower the value, the less the constraint will fight velocities which violate the angular limits

Member Function Documentation

◆ Create6DOF()

static proto Physics6DOFJoint PhysicsJoint.Create6DOF ( notnull IEntity ent1,
IEntity ent2,
vector matrix1[4],
vector matrix2[4],
bool disableCollisions,
float breakThreshold = -1 )
static

Creates 6 DOF joint.

Entities must be dynamic objects. Using only ent1 anchors it to the world.

IEntity entity1 = GetWorld().FindEntityByName("entity1");
IEntity entity2 = GetWorld().FindEntityByName("entity1");
vector mat1[4] = { vector.Right, vector.Up, vector.Forward, vector.Right };
vector mat2[4] = { vector.Right, vector.Up, vector.Forward, -vector.Right };
Physics6DOFJoint joint = PhysicsJoint.Create6DOF(entity1, entity2, mat1, mat2, false);
joint.SetLimit(0, -1, 1);
Definition IEntity.c:13
6 DOF joint simulation.
Definition Physics6DOFJoint.c:30
proto external void SetAngularLimits(vector angularLower, vector angularUpper)
Sets angular limits of the joint.
proto external void SetLimit(int axis, float limitLower, float limitUpper)
Sets limits of the joint.
Wrapper over joint simulation.
Definition PhysicsJoint.c:28
static proto Physics6DOFJoint Create6DOF(notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
Creates 6 DOF joint.
Definition vector.c:13
static const vector Right
Definition vector.c:18
static const vector Up
Definition vector.c:17
static const vector Forward
Definition vector.c:19
static const vector Zero
Definition vector.c:20
Parameters
ent1Entity that will be part of the joint, mandatory
ent2Other entity that will be part of the joint, optional
matrix1Joint transformation in reference frame of ent1
matrix2Joint transformation in reference frame of ent2
disableCollisionsTrue to disable collisions between connected entities
breakThresholdMaximum impulse to break the joint. Use -1 for unbreakable joint

◆ Create6DOFSpring()

static proto Physics6DOFSpringJoint PhysicsJoint.Create6DOFSpring ( notnull IEntity ent1,
IEntity ent2,
vector matrix1[4],
vector matrix2[4],
bool disableCollisions,
float breakThreshold = -1 )
static

Creates DOF spring joint.

Entities must be dynamic objects. Using only ent1 anchors it to the world.

IEntity entity1 = GetWorld().FindEntityByName("entity1");
IEntity entity2 = GetWorld().FindEntityByName("entity1");
vector mat1[4] = { vector.Right, vector.Up, vector.Forward, vector.Right };
vector mat2[4] = { vector.Right, vector.Up, vector.Forward, -vector.Right };
Physics6DOFSpringJoint joint = PhysicsJoint.Create6DOF(entity1, entity2, mat1, mat2, false);
joint.SetLimit(0, -1, 1);
joint.SetSpring(0, 1, 1);
6 DOF spring joint simulation.
Definition Physics6DOFSpringJoint.c:16
proto external void SetSpring(int axis, float stiffness, float damping)
Sets spring parameters on a particular axis.
Parameters
ent1Entity that will be part of the joint, mandatory
ent2Other entity that will be part of the joint, optional
matrix1Joint transformation in reference frame of ent1
matrix2Joint transformation in reference frame of ent2
disableCollisionsTrue to disable collisions between connected entities
breakThresholdMaximum impulse to break the joint. Use -1 for unbreakable joint

◆ CreateBallSocket()

static proto PhysicsBallSocketJoint PhysicsJoint.CreateBallSocket ( notnull IEntity ent1,
IEntity ent2,
vector point1,
vector point2,
bool disableCollisions,
float breakThreshold = -1 )
static

Creates ball socket joint.

Entities must be dynamic objects. Using only ent1 anchors it to the world.

IEntity entity1 = GetWorld().FindEntityByName("entity1");
IEntity entity2 = GetWorld().FindEntityByName("entity1");
PhysicsJoint.CreateBallSocket(entity1, entity2, vector.Right, -vector.Right, false);
static proto PhysicsBallSocketJoint CreateBallSocket(notnull IEntity ent1, IEntity ent2, vector point1, vector point2, bool disableCollisions, float breakThreshold=-1)
Creates ball socket joint.
Parameters
ent1Entity that will be part of the joint, mandatory
ent2Other entity that will be part of the joint, optional
point1Joint position in reference frame of ent1
point2Joint position in reference frame of ent2
disableCollisionsTrue to disable collisions between connected entities
breakThresholdMaximum impulse to break the joint. Use -1 for unbreakable joint

◆ CreateConeTwist()

static proto PhysicsConeTwistJoint PhysicsJoint.CreateConeTwist ( notnull IEntity ent1,
IEntity ent2,
vector matrix1[4],
vector matrix2[4],
bool disableCollisions,
float breakThreshold = -1 )
static

Creates cone twist joint.

Entities must be dynamic objects. Using only ent1 anchors it to the world.

IEntity entity1 = GetWorld().FindEntityByName("entity1");
IEntity entity2 = GetWorld().FindEntityByName("entity1");
vector mat1[4] = { vector.Right, vector.Up, vector.Forward, vector.Right };
vector mat2[4] = { vector.Right, vector.Up, vector.Forward, -vector.Right };
PhysicsJoint.CreateConeTwist(entity1, entity2, mat1, mat2, false);
static proto PhysicsConeTwistJoint CreateConeTwist(notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
Creates cone twist joint.
Parameters
ent1Entity that will be part of the joint, mandatory
ent2Other entity that will be part of the joint, optional
matrix1Joint transformation in reference frame of ent1 (twist is x-axis, swings are z and y axes)
matrix2Joint transformation in reference frame of ent2 (twist is x-axis, swings are z and y axes)
disableCollisionsTrue to disable collisions between connected entities
breakThresholdMaximum impulse to break the joint. Use -1 for unbreakable joint

◆ CreateFixed()

static proto PhysicsFixedJoint PhysicsJoint.CreateFixed ( notnull IEntity ent1,
IEntity ent2,
vector point1,
vector point2,
bool disableCollisions,
float breakThreshold = -1 )
static

Creates fixed joint.

Entities must be dynamic objects. Using only ent1 anchors it to the world.

IEntity entity1 = GetWorld().FindEntityByName("entity1");
IEntity entity2 = GetWorld().FindEntityByName("entity1");
PhysicsJoint.CreateFixed(entity1, entity2, vector.Right, -vector.Right, false);
static proto PhysicsFixedJoint CreateFixed(notnull IEntity ent1, IEntity ent2, vector point1, vector point2, bool disableCollisions, float breakThreshold=-1)
Creates fixed joint.
Parameters
ent1Entity that will be part of the joint, mandatory
ent2Other entity that will be part of the joint, optional
point1Joint position in reference frame of ent1
point2Joint position in reference frame of ent2
disableCollisionsTrue to disable collisions between connected entities
breakThresholdMaximum impulse to break the joint. Use -1 for unbreakable joint

◆ CreateHinge()

static proto PhysicsHingeJoint PhysicsJoint.CreateHinge ( notnull IEntity ent1,
IEntity ent2,
vector point1,
vector axis1,
vector point2,
vector axis2,
bool disableCollisions,
float breakThreshold = -1 )
static

Creates hinge joint.

Entities must be dynamic objects. Using only ent1 anchors it to the world.

IEntity entity1 = GetWorld().FindEntityByName("entity1");
IEntity entity2 = GetWorld().FindEntityByName("entity1");
static proto PhysicsHingeJoint CreateHinge(notnull IEntity ent1, IEntity ent2, vector point1, vector axis1, vector point2, vector axis2, bool disableCollisions, float breakThreshold=-1)
Creates hinge joint.
Parameters
ent1Entity that will be part of the joint, mandatory
ent2Other entity that will be part of the joint, optional
point1Joint position in reference frame of ent1
axis1Joint axis in reference frame of ent1
point2Joint position in reference frame of ent2
axis2Joint axis in reference frame of ent2
disableCollisionsTrue to disable collisions between connected entities
breakThresholdMaximum impulse to break the joint. Use -1 for unbreakable joint

◆ CreateHinge2()

static proto PhysicsHingeJoint PhysicsJoint.CreateHinge2 ( notnull IEntity ent1,
IEntity ent2,
vector matrix1[4],
vector matrix2[4],
bool disableCollisions,
float breakThreshold = -1 )
static

Creates hinge joint.

Entities must be dynamic objects. Using only ent1 anchors it to the world.

IEntity entity1 = GetWorld().FindEntityByName("entity1");
IEntity entity2 = GetWorld().FindEntityByName("entity1");
vector mat1[4] = { vector.Right, -vector.Forward, vector.Up, vector.Right };
vector mat2[4] = { vector.Right, -vector.Forward, vector.Up, -vector.Right };
PhysicsJoint.CreateHinge2(entity1, entity2, mat1, mat2, false);
static proto PhysicsHingeJoint CreateHinge2(notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
Creates hinge joint.
Parameters
ent1Entity that will be part of the joint, mandatory
ent2Other entity that will be part of the joint, optional
matrix1Joint transformation in reference frame of ent1 (hinge is z-axis)
matrix2Joint transformation in reference frame of ent2 (hinge is z-axis)
disableCollisionsTrue to disable collisions between connected entities
breakThresholdMaximum impulse to break the joint. Use -1 for unbreakable joint

◆ CreateSlider()

static proto PhysicsSliderJoint PhysicsJoint.CreateSlider ( notnull IEntity ent1,
IEntity ent2,
vector matrix1[4],
vector matrix2[4],
bool disableCollisions,
float breakThreshold = -1 )
static

Creates slider joint.

Entities must be dynamic objects. Using only ent1 anchors it to the world.

IEntity entity1 = GetWorld().FindEntityByName("entity1");
IEntity entity2 = GetWorld().FindEntityByName("entity1");
vector mat1[4] = { vector.Right, vector.Up, vector.Forward, vector.Right };
vector mat2[4] = { vector.Right, vector.Up, vector.Forward, -vector.Right };
PhysicsJoint.CreateSlider(entity1, entity2, mat1, mat2, false);
static proto PhysicsSliderJoint CreateSlider(notnull IEntity ent1, IEntity ent2, vector matrix1[4], vector matrix2[4], bool disableCollisions, float breakThreshold=-1)
Creates slider joint.
Parameters
ent1Entity that will be part of the joint, mandatory
ent2Other entity that will be part of the joint, optional
matrix1Joint transformation in reference frame of ent1 (slide is x-axis)
matrix2Joint transformation in reference frame of ent2 (slide is x-axis)
disableCollisionsTrue to disable collisions between connected entities
breakThresholdMaximum impulse to break the joint. Use -1 for unbreakable joint

◆ Destroy()

proto external void PhysicsJoint.Destroy ( )

Destroys joint.


The documentation for this interface was generated from the following file: