< GeeXLab Reference Guide />

> Back to Reference Guide Index


gh_physx4 library

Description

gh_physx4 is the module that manages NVIDIA PhysX 4 engine. Thanks to gh_physx4, you will be able to play with rigid bodiy collisions, and handling joints. Clothes and particles are no longer part of PhysX 4.


Number of functions: 75

  1. gh_physx4.actor_add_force ()
  2. gh_physx4.actor_add_force_at_position ()
  3. gh_physx4.actor_apply_transform ()
  4. gh_physx4.actor_get_transform_mat16 ()
  5. gh_physx4.actor_get_transform_pos_qrot ()
  6. gh_physx4.actor_clear_forces ()
  7. gh_physx4.actor_get_angular_speed2 ()
  8. gh_physx4.actor_get_angular_velocity ()
  9. gh_physx4.actor_get_linear_speed2 ()
  10. gh_physx4.actor_get_linear_velocity ()
  11. gh_physx4.actor_get_orientation ()
  12. gh_physx4.actor_get_position ()
  13. gh_physx4.actor_get_sleep_threshold ()
  14. gh_physx4.actor_is_sleeping ()
  15. gh_physx4.actor_kill ()
  16. gh_physx4.actor_put_to_sleep ()
  17. gh_physx4.actor_set_3d_object ()
  18. gh_physx4.actor_set_angular_damping ()
  19. gh_physx4.actor_set_angular_velocity ()
  20. gh_physx4.actor_set_euler_angles ()
  21. gh_physx4.actor_set_gravity_state ()
  22. gh_physx4.actor_set_kinematic_state ()
  23. gh_physx4.actor_set_kinematic_target ()
  24. gh_physx4.actor_set_linear_damping ()
  25. gh_physx4.actor_set_linear_velocity ()
  26. gh_physx4.actor_set_material ()
  27. gh_physx4.actor_set_orientation ()
  28. gh_physx4.actor_set_position ()
  29. gh_physx4.actor_set_sleep_threshold ()
  30. gh_physx4.actor_set_solver_iterations ()
  31. gh_physx4.actor_update_mass ()
  32. gh_physx4.actor_wake_up ()
  33. gh_physx4.check_results ()
  34. gh_physx4.create_actor_box ()
  35. gh_physx4.create_actor_capsule ()
  36. gh_physx4.create_actor_mesh ()
  37. gh_physx4.create_actor_mesh_v2 ()
  38. gh_physx4.create_actor_plane ()
  39. gh_physx4.create_actor_sphere ()
  40. gh_physx4.create_material ()
  41. gh_physx4.create_scene ()
  42. gh_physx4.create_scene_broadphase_abp ()
  43. gh_physx4.create_scene_broadphase_gpu ()
  44. gh_physx4.create_scene_broadphase_mbp ()
  45. gh_physx4.create_scene_broadphase_sap ()
  46. gh_physx4.fetch_results ()
  47. gh_physx4.gpu_get_clock_frequency_khz ()
  48. gh_physx4.gpu_get_name ()
  49. gh_physx4.gpu_get_num_multiprocessors ()
  50. gh_physx4.gpu_get_total_memory_size_mb ()
  51. gh_physx4.gpu_is_supported ()
  52. gh_physx4.joint_create ()
  53. gh_physx4.joint_distance_set_distances ()
  54. gh_physx4.joint_distance_set_spring ()
  55. gh_physx4.joint_kill ()
  56. gh_physx4.joint_prismatic_set_limits ()
  57. gh_physx4.joint_revolute_set_angular_limits ()
  58. gh_physx4.joint_revolute_set_rotational_limits ()
  59. gh_physx4.joint_set_break_force ()
  60. gh_physx4.joint_set_motor_params ()
  61. gh_physx4.joint_spherical_set_limit_cone ()
  62. gh_physx4.kill_material ()
  63. gh_physx4.run_simulation ()
  64. gh_physx4.run_simulation_step ()
  65. gh_physx4.scene_sync_3d_objects ()
  66. gh_physx4.set_max_depenetration_velocity ()
  67. gh_physx4.set_scene_gravity ()
  68. gh_physx4.set_simulation_scales ()
  69. gh_physx4.set_solver_iteration_counts ()
  70. gh_physx4.start ()
  71. gh_physx4.stop ()
  72. gh_physx4.update_material ()
  73. gh_physx4.scene_sync_3d_objects_v2 ()
  74. gh_physx4.scene_get_num_active_actors ()
  75. gh_physx4.create_scene_set_solver_type ()



actor_add_force

Description

Adds a force to an actor.


Syntax

gh_physx4.actor_add_force(
 actor_id,
 fx, fy, fz
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_add_force(actor_id, fx, fy, fz)
			


actor_add_force_at_position

Description

Adds a force to an actor at a particular position.


Syntax

gh_physx4.actor_add_force_at_position(
 actor_id,
 fx, fy, fz,
 px, py, pz
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_add_force_at_position(actor_id, fx, fy, fz, px, py, pz)
			


actor_apply_transform

Description

Applies the transformation (position + orientation) of an PhysX actor to a regular 3D object (a mesh for example).


Syntax

gh_physx4.actor_apply_transform(
 actor_id,
 obj_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_apply_transform(actor_id, obj_id)
			


actor_get_transform_mat16

Description

Returns the transformation matrix of a physics actor.


Syntax

m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15 = gh_physx4.actor_get_transform_mat16(
 actor_id
)

Languages


Parameters


Return Values


Code sample


m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m13,m14,m15 = gh_physx4.actor_get_transform_mat16(actor_id)
			


actor_get_transform_pos_qrot

Description

Returns the position and orientation (quaternion) of a physics actor.


Syntax

px, py, pz, qx, qy, qz, qw = gh_physx4.actor_get_transform_pos_qrot(
 actor_id
)

Languages


Parameters


Return Values


Code sample


px, py, pz, qx, qy, qz, qw = gh_physx4.actor_get_transform_pos_qrot(actor_id)
			


actor_clear_forces

Description

Clears (resets) all forces that act on an actor.


Syntax

gh_physx4.actor_clear_forces(
 actor_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_clear_forces(actor_id)
			


actor_get_angular_speed2

Description

Gets the squared angular speed of an actor.


Syntax

s = gh_physx4.actor_get_angular_speed2(
 actor_id
)

Languages


Parameters


Return Values


Code sample


s = gh_physx4.actor_get_angular_speed2(actor_id)
			


actor_get_angular_velocity

Description

Gets the angular velocity of an actor.


Syntax

x, y, z = gh_physx4.actor_get_angular_velocity(
 actor_id
)

Languages


Parameters


Return Values


Code sample


x, y, z = gh_physx4.actor_get_angular_velocity(actor_id)
			


actor_get_linear_speed2

Description

Gets the squared linear speed of an actor.


Syntax

speed = gh_physx4.actor_get_linear_speed2(
 actor_id
)

Languages


Parameters


Return Values


Code sample


speed = gh_physx4.actor_get_linear_speed2(actor_id)
			


actor_get_linear_velocity

Description

Gets the linear velocity of an actor.


Syntax

x, y, z = gh_physx4.actor_get_linear_velocity(
 actor_id
)

Languages


Parameters


Return Values


Code sample


x, y, z = ggh_physx4.actor_get_linear_velocity(actor_id)
			


actor_get_orientation

Description

Gets the orientation of an actor (a quaternion).


Syntax

x, y, z, w = gh_physx4.actor_get_orientation(
 actor_id
)

Languages


Parameters


Return Values


Code sample


x, y, z, w = gh_physx4.actor_get_orientation(actor_id)
			


actor_get_position

Description

Gets the global position of an actor.


Syntax

x, y, z = gh_physx4.actor_get_position(
 actor_id
)

Languages


Parameters


Return Values


Code sample


x, y, z = gh_physx4.actor_get_position(actor_id)
			


actor_get_sleep_threshold

Description

Gets the sleep threshold.


Syntax

thres = gh_physx4.actor_get_sleep_threshold(
 actor_id
)

Languages


Parameters


Return Values


Code sample


thres = gh_physx4.actor_get_sleep_threshold(actor_id)
			


actor_is_sleeping

Description

Gets the sleeping state of an actor.


Syntax

state = gh_physx4.actor_is_sleeping(
 actor_id
)

Languages


Parameters


Return Values


Code sample


is_sleeping = gh_physx4.actor_is_sleeping(actor_id)
			


actor_kill

Description

Destroys an actor.


Syntax

gh_physx4.actor_kill(
 actor_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_kill(actor_id)
			


actor_put_to_sleep

Description

Forces an actor to sleep.


Syntax

gh_physx4.actor_put_to_sleep(
 actor_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_put_to_sleep(actor_id)
			


actor_set_3d_object

Description

Allows to associate a physics actor and a 3D object. Useful for the scene_sync_3d_objects() function.


Syntax

gh_physx4.actor_set_3d_object(
 actor_id,
 o3d_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_3d_object(actor_id, o3d_id)
			


actor_set_angular_damping

Description

Sets the angular damping of an actor.


Syntax

gh_physx4.actor_set_angular_damping(
 actor_id,
 damping
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_angular_damping(actor_id, 0.2)
			


actor_set_angular_velocity

Description

Sets the angular velocity of an actor.


Syntax

gh_physx4.actor_set_angular_velocity(
 actor_id,
 vx, vy, vz
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_angular_velocity(actor_id, 0.8, 12, 1.6)
			


actor_set_euler_angles

Description

Sets the orientation of an actor using Euler's angles.


Syntax

gh_physx4.actor_set_euler_angles(
 actor_id,
 pitch, yaw, roll
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_euler_angles(actor_id, 90, 0, 0)
			


actor_set_gravity_state

Description

Sets the gravity state of an actor.


Syntax

gh_physx4.actor_set_gravity_state(
 actor_id,
 state
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_gravity_state(actor_id, 1)
			


actor_set_kinematic_state

Description

Sets the kinematic state of an actor.


Syntax

gh_physx4.actor_set_kinematic_state(
 actor_id,
 state
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_kinematic_state(actor_id, 1)
			


actor_set_kinematic_target

Description

Moves kinematically controlled dynamic actors through the 3d world.


Syntax

gh_physx4.actor_set_kinematic_target(
 actor_id,
 px, py, pz,
 pitch, yaw, roll
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_kinematic_target(actor_id, px, py, pz, pitch, yaw, roll)
			


actor_set_linear_damping

Description

Sets the linear damping of an actor.


Syntax

gh_physx4.actor_set_linear_damping(
 actor_id,
 damping
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_linear_damping(actor_id, 0.2)
			


actor_set_linear_velocity

Description

Sets the linear velocity of an actor.


Syntax

gh_physx4.actor_set_linear_velocity(
 actor_id,
 vx, vy, vz
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_linear_velocity(actor_id, 10, 10, 10)
			


actor_set_material

Description

Sets a material to an actor.


Syntax

gh_physx4.actor_set_material(
 actor_id,
 mat_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_material(actor_id, mat_id)
			


actor_set_orientation

Description

Sets the orientation of an actor (a quaternion).


Syntax

gh_physx4.actor_set_orientation(
 actor_id,
 x, y, z, w
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_orientation(actor_id, x, y, z, w)
			


actor_set_position

Description

Sets the global position of an actor.


Syntax

gh_physx4.actor_set_position(
 actor_id,
 x, y, z
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_position(actor_id, x, y, z)
			


actor_set_sleep_threshold

Description

Sets the sleep threshold.


Syntax

gh_physx4.actor_set_sleep_threshold(
 actor_id,
 thres
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_set_sleep_threshold(actor_id, 0.2)
			


actor_set_solver_iterations

Description

Sets the number of solver iterations for an actor.


Syntax

gh_physx4.actor_set_solver_iterations(
 actor_id,
 position_iterations,
 velocity_iterations
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


position_iterations = 4
velocity_iterations = 1

gh_physx4.actor_set_solver_iterations(actor_id, position_iterations, velocity_iterations)
			


actor_update_mass

Description

Update the mass of an actor from the density.


Syntax

gh_physx4.actor_update_mass(
 actor_id,
 density
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_update_mass(actor_id, density)
			


actor_wake_up

Description

Wakes up an actor.


Syntax

gh_physx4.actor_wake_up(
 actor_id,
 sleep_counter
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.actor_wake_up(actor_id, 1)
			


check_results

Description

Checks if results of a simulation step are available.


Syntax

ret = gh_physx4.check_results(
 scene_id
)

Languages


Parameters


Return Values


Code sample


if (can_run_sim) then
    gh_physx4.run_simulation_step(scene_id, time_step)
    can_run_sim = false
end

if (gh_physx4.check_results(scene_id) == 1) then
    gh_physx4.fetch_results(scene_id)
    can_run_sim = true
end
			


create_actor_box

Description

Creates a box actor.


Syntax

actor_id = gh_physx4.create_actor_box(
 scene_id,
 w, h, d,
 px, py, pz,
 density,
 mat_id
)

Languages


Parameters


Return Values


Code sample


actor_box = gh_physx4.create_actor_box(scene_id, 4, 4, 4, 0, 0, 0, density, mat_id)
			


create_actor_capsule

Description

Creates a capsule actor.


Syntax

actor_id = gh_physx4.create_actor_capsule(
 scene_id,
 radius,
 half_height,
 px, py, pz,
 density,
 mat_id
)

Languages


Parameters


Return Values


Code sample


actor_capsule = gh_physx4.create_actor_capsule(scene_id, radius, half_height, 0, 0, 0, density, mat_id)
			


create_actor_mesh

Description

Creates an actor from a mesh.


Syntax

actor_id = gh_physx4.create_actor_mesh(
 scene_id,
 mesh_id,
 px, py, pz,
 density,
 mat_id
)

Languages


Parameters


Return Values


Code sample


actor_mesh = gh_physx4.create_actor_mesh(scene_id, mesh_id, 0, 0, 0, density, mat_id)
			


create_actor_mesh_v2

Description

Creates an actor from a mesh. You can specify if the mesh is convex or not. Only vertices of a convex mesh are used by PhysX. To be GPU friendly, the number of vertices must not exceed 64.


Syntax

actor_id = gh_physx4.create_actor_mesh_v2(
 scene_id,
 mesh_id,
 px, py, pz,
 density,
 mat_id,
 convex
)

Languages


Parameters


Return Values


Code sample


convex = 1
actor_mesh = gh_physx4.create_actor_mesh_v2(scene_id, mesh_id, 0, 0, 0, density, mat_id, convex)
			


create_actor_plane

Description

Creates a plane actor.


Syntax

actor_id = gh_physx4.create_actor_plane(
 scene_id,
 nx, ny, nz, d,
 mat_id
)

Languages


Parameters


Return Values


Code sample


actor_plane = gh_physx4.create_actor_plane(scene_id, 0, 1, 0, 0, mat_id)
			


create_actor_sphere

Description

Creates a sphere actor.


Syntax

actor_id = gh_physx4.create_actor_sphere(
 scene_id,
 radius,
 px, py, pz,
 density,
 mat_id
)

Languages


Parameters


Return Values


Code sample


actor_sphere = gh_physx4.create_actor_sphere(scene_id, 10, 0, 0, 0, density, mat_id)
			


create_material

Description

Creates a PhysX material.


Syntax

mat_id = gh_physx4.create_material(
 static_friction,
 dynamic_friction,
 resilience
)

Languages


Parameters


Return Values


Code sample


mat_id = gh_physx4.create_material(0.5, 0.5, 0.5)
			


create_scene

Description

Creates a PhysX scene - DEPRECATED


Syntax

scene_id = gh_physx4.create_scene(
 gpu_physx,
 bounce_threshold_velocity
)

Languages


Parameters


Return Values


Code sample


bounce_threshold_velocity = 0.2

scene_id = gh_physx4.create_scene(1, bounce_threshold_velocity)
			


create_scene_broadphase_abp

Description

Creates a CPU PhysX scene with ABP (revisited implementation of MBP, new in PhysX 4) broadphase algorithm.


Syntax

scene_id = gh_physx4.create_scene_broadphase_abp(
 bounce_threshold_velocity,
 enable_ccd,
 enable_contact_reporting,
 enable_stabilization
)

Languages


Parameters


Return Values


Code sample


bounce_threshold_velocity = 0.2
enable_ccd = 1
enable_contact_reporting = 0
enable_stabilization = 1

scene_id = gh_physx4.create_scene_broadphase_abp(bounce_threshold_velocity, enable_ccd, enable_contact_reporting, enable_stabilization)
			


create_scene_broadphase_gpu

Description

Creates a GPU PhysX scene.


Syntax

scene_id = gh_physx4.create_scene_broadphase_gpu(
 bounce_threshold_velocity,
 enable_ccd,
 enable_contact_reporting,
 enable_stabilization
)

Languages


Parameters


Return Values


Code sample


bounce_threshold_velocity = 0.2
enable_ccd = 1
enable_contact_reporting = 0
enable_stabilization = 1

scene_id = gh_physx4.create_scene_broadphase_gpu(bounce_threshold_velocity, enable_ccd, enable_contact_reporting, enable_stabilization)
			


create_scene_broadphase_mbp

Description

Creates a CPU PhysX scene with MBP (Multi-Box Pruning) broadphase algorithm.


Syntax

scene_id = gh_physx4.create_scene_broadphase_mbp(
 bounce_threshold_velocity,
 enable_ccd,
 enable_contact_reporting,
 enable_stabilization,
 minX, minY, minZ,
 maxX, maxY, maxZ
)

Languages


Parameters


Return Values


Code sample


bounce_threshold_velocity = 0.2
enable_ccd = 1
enable_contact_reporting = 0
enable_stabilization = 1

minX = -100
minY = 0
minZ = -100
maxX = 100,
maxY = 100
maxZ = 100

scene_id = gh_physx4.create_scene_broadphase_mbp(bounce_threshold_velocity, enable_ccd, enable_contact_reporting, enable_stabilization, minX, minY, minZ, maxX, maxY, maxZ)
			


create_scene_broadphase_sap

Description

Creates a CPU PhysX scene with SAP (Multi-Box Pruning) broadphase algorithm.


Syntax

scene_id = gh_physx4.create_scene_broadphase_sap(
 bounce_threshold_velocity,
 enable_ccd,
 enable_contact_reporting,
 enable_stabilization
)

Languages


Parameters


Return Values


Code sample


bounce_threshold_velocity = 0.2
enable_ccd = 1
enable_contact_reporting = 0
enable_stabilization = 1

scene_id = gh_physx4.create_scene_broadphase_sap(bounce_threshold_velocity, enable_ccd, enable_contact_reporting, enable_stabilization)
			


fetch_results

Description

Fetches the results of a simulation step.


Syntax

ret = gh_physx4.fetch_results(
 scene_id
)

Languages


Parameters


Return Values


Code sample


ret = gh_physx4.run_simulation_step(scene_id, time_step)

ret = gh_physx4.fetch_results(scene_id)
			


gpu_get_clock_frequency_khz

Description

Gets the clock speed of the PhysX GPU.


Syntax

clock = gh_physx4.gpu_get_clock_frequency_khz()

Languages


Parameters

This function has no input parameter(s).


Return Values


Code sample


clock = gh_physx4.gpu_get_clock_frequency_khz()
			


gpu_get_name

Description

Gets the name of the PhysX GPU.


Syntax

name = gh_physx4.gpu_get_name()

Languages


Parameters

This function has no input parameter(s).


Return Values


Code sample


gpu_name = gh_physx4.gpu_get_name()
			


gpu_get_num_multiprocessors

Description

Gets the number of SMs of the PhysX GPU.


Syntax

num_sm = gh_physx4.gpu_get_num_multiprocessors()

Languages


Parameters

This function has no input parameter(s).


Return Values


Code sample


gpu_sm = gh_physx4.gpu_get_num_multiprocessors()
			


gpu_get_total_memory_size_mb

Description

Gets the size of the PhysX GPU memory.


Syntax

size = gh_physx4.gpu_get_total_memory_size_mb()

Languages


Parameters

This function has no input parameter(s).


Return Values


Code sample


size = gh_physx4.gpu_get_total_memory_size_mb()
			


gpu_is_supported

Description

Checks for PhysX GPU support (Windows only).


Syntax

ret = gh_physx4.gpu_is_supported()

Languages


Parameters

This function has no input parameter(s).


Return Values


Code sample


gpu_physx = gh_physx4.gpu_is_supported()
			


joint_create

Description

Creates a PhysX joint between two PhysX actors.


Syntax

joint_id = gh_physx4.joint_create(
 scene_id,
 joint_type,
 actor1_id,
 x1, y1, z1,
 pitch1, yaw1, roll1,
 actor2_id,
 x2, y2, z2,
 pitch2, yaw2, roll2
)

Languages


Parameters


Return Values


Code sample


joint_id = gh_physx4.joint_create(scene_id, joint_type, actor1, x1, y1, z1, pitch1, yaw1, roll1, actor2, x2, y2, z2, pitch2, yaw2, roll2)
			


joint_distance_set_distances

Description

Sets distance joint distance range.


Syntax

gh_physx4.joint_distance_set_distances(
 joint_id,
 min_distance, max_distance
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_distance_set_distances(joint_id, min_distance, max_distance)
			


joint_distance_set_spring

Description

Sets distance joint spring parameters.


Syntax

gh_physx4.joint_distance_set_spring(
 joint_id,
 spring_coef, damping_coef
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_distance_set_spring(joint_id, spring_coef, damping_coef)
			


joint_kill

Description

Kills a PhysX joint.


Syntax

gh_physx4.joint_kill(
 joint_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_kill(joint_id)
			


joint_prismatic_set_limits

Description

Sets prismatic joint parameters.


Syntax

gh_physx4.joint_prismatic_set_limits(
 joint_id,
 lower_limit, upper_limit,
 limit_contact_distance
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_prismatic_set_limits(joint_id, lower_limit, upper_limit, limit_contact_distance)
			


joint_revolute_set_angular_limits

Description

Sets revolute joint angular limits.


Syntax

gh_physx4.joint_revolute_set_angular_limits(
 joint_id,
 lower_limit, upper_limit,
 limit_contact_distance,
 damping,
 stiffness,
 restitution,
 bounce_threshold
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_revolute_set_angular_limits(joint_id, lower_limit, upper_limit, limit_contact_distance, damping, stiffness, restitution, bounce_threshold)
			


joint_revolute_set_rotational_limits

Description

Sets revolute joint parameters.


Syntax

gh_physx4.joint_revolute_set_rotational_limits(
 joint_id,
 lower_limit, upper_limit,
 limit_contact_distance
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_revolute_set_rotational_limits(joint_id, lower_limit, upper_limit, limit_contact_distance)
			


joint_set_break_force

Description

Set the breaking force of a PhysX joint.


Syntax

gh_physx4.joint_set_break_force(
 joint_id,
 force, torque
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_set_break_force(joint_id, force, torque)
			


joint_set_motor_params

Description

Sets motor parameters of a revolute joint.


Syntax

gh_physx4.joint_set_motor_params(
 joint_id,
 velocity, max_force,
 drive_enabled, free_spin_enabled
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_set_motor_params(joint_id, velocity, max_force, drive_enabled, free_spin_enabled)
			


joint_spherical_set_limit_cone

Description

Sets parameters of a spherical joint.


Syntax

gh_physx4.joint_spherical_set_limit_cone(
 joint_id,
 y_limit_angle, z_limit_angle, limit_contact_distance
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.joint_spherical_set_limit_cone(joint_id, y_limit_angle, z_limit_angle, limit_contact_distance)
			


kill_material

Description

Destroys a material.


Syntax

gh_physx4.kill_material(
 mat_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.kill_material(mat_id)
			


run_simulation

Description

Runs a complete simulation (step + fetch).


Syntax

ret = gh_physx4.run_simulation(
 scene_id,
 dt,
 time_step
)

Languages


Parameters


Return Values


Code sample


ret = gh_physx4.run_simulation(scene_id, dt, time_step)
			


run_simulation_step

Description

Runs a simulation step.


Syntax

ret = gh_physx4.run_simulation_step(
 scene_id,
 time_step
)

Languages


Parameters


Return Values


Code sample


ret = gh_physx4.run_simulation_step(scene_id, time_step)
			


scene_sync_3d_objects

Description

Synchronizes physics and graphics objects. A physcis actor is associated to a 3D object using the actor_set_3d_object() function.


Syntax

gh_physx4.scene_sync_3d_objects(
 scene_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.scene_sync_3d_objects(scene_id)
			


set_max_depenetration_velocity

Description

Sets the max depenetration velocity. This a global value applied to each new actor.


Syntax

gh_physx4.set_max_depenetration_velocity(
 velocity
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


velocity = 3.0

gh_physx4.set_max_depenetration_velocity(velocity)
...
actor_box = gh_physx4.create_actor_box(scene, 4, 4, 4, 0, 0, 0, density, mat_id)
			


set_scene_gravity

Description

Sets the scene gravity vector.


Syntax

gh_physx4.set_scene_gravity(
 scene_id,
 x, y, z
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.set_scene_gravity(scene_id, 0, -9.81, 0)
			


set_simulation_scales

Description

Sets the various scales to get realistic physics simulations (to avoid the famous Moon effect).


Syntax

gh_physx4.set_simulation_scales(
 size,
 mass,
 speed
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.set_simulation_scales(1, 1000, 10)
			


set_solver_iteration_counts

Description

Sets the number of solver iterations. This a global value applied to each new actor.


Syntax

gh_physx4.set_solver_iteration_counts(
 position_iterations,
 velocity_iterations
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


position_iterations = 4
velocity_iterations = 1

gh_physx4.set_solver_iteration_counts(position_iterations, velocity_iterations)
...
actor_box = gh_physx4.create_actor_box(scene, 4, 4, 4, 0, 0, 0, density, mat_id)
			


start

Description

Starts the PhysX engine.


Syntax

ret = gh_physx4.start()

Languages


Parameters

This function has no input parameter(s).


Return Values


Code sample


ret = gh_physx4.start()
			


stop

Description

Stops the PhysX engine.


Syntax

ret = gh_physx4.stop()

Languages


Parameters

This function has no input parameter(s).


Return Values


Code sample


ret = gh_physx4.stop()
			


update_material

Description

Updates the properties of a material.


Syntax

gh_physx4.update_material(
 mat_id,
 static_friction,
 dynamic_friction,
 resilience
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


static_friction = 0.5
dynamic_friction = 0.5
resilience = 0.9

gh_physx4.update_material(mat_id, static_friction, dynamic_friction, resilience)
			


scene_sync_3d_objects_v2

Description

Synchronizes physics and graphics objects. A physcis actor is associated to a 3D object using the actor_set_3d_object() function. Compared to scene_sync_3d_objects(), this function synchronizes only PhysX active actors (actors that have been updated by the PhysX engine).


Syntax

gh_physx4.scene_sync_3d_objects_v2(
 scene_id
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.scene_sync_3d_objects_v2(scene_id)
			


scene_get_num_active_actors

Description

Get the number of active PhysX actors.


Syntax

n = gh_physx4.scene_get_num_active_actors(
 scene_id
)

Languages


Parameters


Return Values


Code sample


n = gh_physx4.scene_get_num_active_actors(scene_id)
			


create_scene_set_solver_type

Description

Set the solver that will be used to create a PhysX scene.Synchronizes physics and graphics objects. A physcis actor is associated to a 3D object using the actor_set_3d_object() function. Compared to scene_sync_3d_objects(), this function synchronizes only PhysX active actors (actors that have been updated by the PhysX engine). If used, create_scene_set_solver_type() must be called before any scene creation function.


Syntax

gh_physx4.create_scene_set_solver_type(
 solver_type
)

Languages


Parameters


Return Values

This function has no return value(s).


Code sample


gh_physx4.create_scene_set_solver_type(solver_type)
			






GeeXLab Rootard Guide | Downloads | Contact | Newsletter