editor.physicsasset

Physics Asset body and constraint editing

← API Reference

editor.physicsasset.getInfo

Returns basic information about a physics asset.

Parameters:

Name Type Required Description
asset_pathstringYesPhysicsAsset path

Returns:

Name Type Description
num_bodiesnumberNumber of physics bodies
num_constraintsnumberNumber of constraints
skeletal_mesh_pathstringAssociated skeletal mesh path

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.getInfo", "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset" } }

editor.physicsasset.getBodies

Returns all physics bodies in a physics asset.

Parameters:

Name Type Required Description
asset_pathstringYesPhysicsAsset path

Returns:

Name Type Description
bodiesarrayEach: {body_name, bone_name, collision_type, mass, num_shapes}

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.getBodies", "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset" } }

editor.physicsasset.getConstraints

Returns all constraints in a physics asset.

Parameters:

Name Type Required Description
asset_pathstringYesPhysicsAsset path

Returns:

Name Type Description
constraintsarrayEach: {constraint_name, parent_bone, child_bone, constraint_type, is_enabled}

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.getConstraints", "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset" } }

editor.physicsasset.setBodyProperty

Sets a property on a physics body.

Parameters:

Name Type Required Description
asset_pathstringYesPhysicsAsset path
body_namestringYesBody name
propertystringYes"mass" (number), "collision_enabled" (bool), or "physics_type" (string: "Default", "Kinematic", "Simulated")
valuevariesYesProperty value

Returns:

Name Type Description
successboolWhether property was set

Example Request:

{
  "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.setBodyProperty",
  "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset", "body_name": "spine_01", "property": "mass", "value": 10.0 }
}

editor.physicsasset.setConstraintProperty

Sets a property on a physics constraint.

Parameters:

Name Type Required Description
asset_pathstringYesPhysicsAsset path
constraint_namestringYesConstraint name
propertystringYes"disable_collision" (bool), "parent_dominates" (bool), "enable_projection" (bool), "swing1_limit" (number), "swing2_limit" (number), "twist_limit" (number)
valuevariesYesProperty value

Returns:

Name Type Description
successboolWhether property was set

Example Request:

{
  "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.setConstraintProperty",
  "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset", "constraint_name": "spine_01_spine_02", "property": "swing1_limit", "value": 30.0 }
}

editor.physicsasset.setAllBodiesSimulatePhysics

Sets physics simulation mode for all bodies in a physics asset.

Parameters:

Name Type Required Description
asset_pathstringYesPhysicsAsset path
simulateboolYesWhether to enable physics simulation

Returns:

Name Type Description
successboolWhether operation succeeded
bodies_updatednumberNumber of bodies updated

Example Request:

{
  "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.setAllBodiesSimulatePhysics",
  "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset", "simulate": true }
}

editor.physicsasset.getCollisionState

Checks whether collision is enabled between two bodies.

Parameters:

Name Type Required Description
asset_pathstringYesPhysics asset path
body_astringYesFirst body bone name
body_bstringYesSecond body bone name

Returns:

Name Type Description
collision_enabledboolWhether collision is enabled between the two bodies
body_astringFirst body name
body_bstringSecond body name

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.getCollisionState", "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset", "body_a": "pelvis", "body_b": "spine_01" } }

editor.physicsasset.setCollisionState

Enables or disables collision between two bodies.

Parameters:

Name Type Required Description
asset_pathstringYesPhysics asset path
body_astringYesFirst body bone name
body_bstringYesSecond body bone name
enabledboolYesWhether to enable collision

Returns:

Name Type Description
successboolWhether collision state was changed

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.setCollisionState", "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset", "body_a": "pelvis", "body_b": "spine_01", "enabled": false } }

editor.physicsasset.getConstraintLimits

Gets constraint limit values (linear, swing, twist) for a physics constraint.

Parameters:

Name Type Required Description
asset_pathstringYesPhysics asset path
constraint_indexnumberNoConstraint index (use this or bone_name)
bone_namestringNoBone name to find constraint

Returns:

Name Type Description
constraint_indexnumberConstraint index
joint_namestringJoint name
bone1stringFirst bone
bone2stringSecond bone
linear_limitnumberLinear limit distance
linear_x_motionstringX axis motion (Free/Limited/Locked)
linear_y_motionstringY axis motion
linear_z_motionstringZ axis motion
swing1_limitnumberSwing 1 angle limit
swing2_limitnumberSwing 2 angle limit
twist_limitnumberTwist angle limit
swing1_motionstringSwing 1 motion type
swing2_motionstringSwing 2 motion type
twist_motionstringTwist motion type

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.getConstraintLimits", "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset", "constraint_index": 0 } }

editor.physicsasset.setConstraintLimits

Sets constraint limit values. Only provided values are changed.

Parameters:

Name Type Required Description
asset_pathstringYesPhysics asset path
constraint_indexnumberYesConstraint index
linear_limitnumberNoLinear limit distance
swing1_limitnumberNoSwing 1 angle limit
swing2_limitnumberNoSwing 2 angle limit
twist_limitnumberNoTwist angle limit

Returns:

Name Type Description
successboolWhether limits were set
constraint_indexnumberConstraint index

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.setConstraintLimits", "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset", "constraint_index": 0, "swing1_limit": 45.0, "twist_limit": 30.0 } }

editor.physicsasset.getBodyDetails

Gets detailed information about a specific physics body setup.

Parameters:

Name Type Required Description
asset_pathstringYesPhysics asset path
body_namestringYesBody bone name

Returns:

Name Type Description
bone_namestringBone name
body_indexnumberBody index in the asset
simulate_physicsboolWhether physics is simulated
collision_responsestringCollision enabled type
physics_typestringDefault/Kinematic/Simulated
num_spheresnumberSphere collision shapes
num_boxesnumberBox collision shapes
num_capsulesnumberCapsule collision shapes
num_convexnumberConvex collision shapes
num_tapered_capsulesnumberTapered capsule shapes
mass_override_setboolWhether mass is overridden
mass_override_kgnumberMass override value in kg

Example Request:

{ "jsonrpc": "2.0", "id": 1, "method": "editor.physicsasset.getBodyDetails", "params": { "asset_path": "/Game/Characters/Hero_PhysicsAsset", "body_name": "pelvis" } }