diff options
Diffstat (limited to 'servers/physics_server.cpp')
-rw-r--r-- | servers/physics_server.cpp | 259 |
1 files changed, 130 insertions, 129 deletions
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index 86bf6253ee..c51a59973c 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -349,12 +349,12 @@ void PhysicsDirectSpaceState::_bind_methods() { ClassDB::bind_method(D_METHOD("collide_shape", "shape", "max_results"), &PhysicsDirectSpaceState::_collide_shape, DEFVAL(32)); ClassDB::bind_method(D_METHOD("get_rest_info", "shape"), &PhysicsDirectSpaceState::_get_rest_info); - BIND_CONSTANT(TYPE_MASK_STATIC_BODY); - BIND_CONSTANT(TYPE_MASK_KINEMATIC_BODY); - BIND_CONSTANT(TYPE_MASK_RIGID_BODY); - BIND_CONSTANT(TYPE_MASK_CHARACTER_BODY); - BIND_CONSTANT(TYPE_MASK_AREA); - BIND_CONSTANT(TYPE_MASK_COLLISION); + BIND_ENUM_CONSTANT(TYPE_MASK_STATIC_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_KINEMATIC_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_RIGID_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_CHARACTER_BODY); + BIND_ENUM_CONSTANT(TYPE_MASK_AREA); + BIND_ENUM_CONSTANT(TYPE_MASK_COLLISION); } int PhysicsShapeQueryResult::get_result_count() const { @@ -506,11 +506,11 @@ void PhysicsServer::_bind_methods() { /* JOINT API */ - BIND_CONSTANT(JOINT_PIN); - BIND_CONSTANT(JOINT_HINGE); - BIND_CONSTANT(JOINT_SLIDER); - BIND_CONSTANT(JOINT_CONE_TWIST); - BIND_CONSTANT(JOINT_6DOF); + BIND_ENUM_CONSTANT(JOINT_PIN); + BIND_ENUM_CONSTANT(JOINT_HINGE); + BIND_ENUM_CONSTANT(JOINT_SLIDER); + BIND_ENUM_CONSTANT(JOINT_CONE_TWIST); + BIND_ENUM_CONSTANT(JOINT_6DOF); ClassDB::bind_method(D_METHOD("joint_create_pin", "body_A", "local_A", "body_B", "local_B"), &PhysicsServer::joint_create_pin); ClassDB::bind_method(D_METHOD("pin_joint_set_param", "joint", "param", "value"), &PhysicsServer::pin_joint_set_param); @@ -522,20 +522,21 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("pin_joint_set_local_b", "joint", "local_B"), &PhysicsServer::pin_joint_set_local_b); ClassDB::bind_method(D_METHOD("pin_joint_get_local_b", "joint"), &PhysicsServer::pin_joint_get_local_b); - BIND_CONSTANT(PIN_JOINT_BIAS); - BIND_CONSTANT(PIN_JOINT_DAMPING); - BIND_CONSTANT(PIN_JOINT_IMPULSE_CLAMP); - - BIND_CONSTANT(HINGE_JOINT_BIAS); - BIND_CONSTANT(HINGE_JOINT_LIMIT_UPPER); - BIND_CONSTANT(HINGE_JOINT_LIMIT_LOWER); - BIND_CONSTANT(HINGE_JOINT_LIMIT_BIAS); - BIND_CONSTANT(HINGE_JOINT_LIMIT_SOFTNESS); - BIND_CONSTANT(HINGE_JOINT_LIMIT_RELAXATION); - BIND_CONSTANT(HINGE_JOINT_MOTOR_TARGET_VELOCITY); - BIND_CONSTANT(HINGE_JOINT_MOTOR_MAX_IMPULSE); - BIND_CONSTANT(HINGE_JOINT_FLAG_USE_LIMIT); - BIND_CONSTANT(HINGE_JOINT_FLAG_ENABLE_MOTOR); + BIND_ENUM_CONSTANT(PIN_JOINT_BIAS); + BIND_ENUM_CONSTANT(PIN_JOINT_DAMPING); + BIND_ENUM_CONSTANT(PIN_JOINT_IMPULSE_CLAMP); + + BIND_ENUM_CONSTANT(HINGE_JOINT_BIAS); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_UPPER); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_LOWER); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_BIAS); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(HINGE_JOINT_LIMIT_RELAXATION); + BIND_ENUM_CONSTANT(HINGE_JOINT_MOTOR_TARGET_VELOCITY); + BIND_ENUM_CONSTANT(HINGE_JOINT_MOTOR_MAX_IMPULSE); + + BIND_ENUM_CONSTANT(HINGE_JOINT_FLAG_USE_LIMIT); + BIND_ENUM_CONSTANT(HINGE_JOINT_FLAG_ENABLE_MOTOR); ClassDB::bind_method(D_METHOD("joint_create_hinge", "body_A", "hinge_A", "body_B", "hinge_B"), &PhysicsServer::joint_create_hinge); @@ -550,60 +551,60 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("slider_joint_set_param", "joint", "param", "value"), &PhysicsServer::slider_joint_set_param); ClassDB::bind_method(D_METHOD("slider_joint_get_param", "joint", "param"), &PhysicsServer::slider_joint_get_param); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_UPPER); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_LOWER); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING); - - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_UPPER); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_LOWER); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION); - BIND_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING); - BIND_CONSTANT(SLIDER_JOINT_MAX); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_UPPER); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_LOWER); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_LIMIT_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_MOTION_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_LINEAR_ORTHOGONAL_DAMPING); + + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_UPPER); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_LOWER); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_LIMIT_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_MOTION_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_SOFTNESS); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_RESTITUTION); + BIND_ENUM_CONSTANT(SLIDER_JOINT_ANGULAR_ORTHOGONAL_DAMPING); + BIND_ENUM_CONSTANT(SLIDER_JOINT_MAX); ClassDB::bind_method(D_METHOD("joint_create_cone_twist", "body_A", "local_ref_A", "body_B", "local_ref_B"), &PhysicsServer::joint_create_cone_twist); ClassDB::bind_method(D_METHOD("cone_twist_joint_set_param", "joint", "param", "value"), &PhysicsServer::cone_twist_joint_set_param); ClassDB::bind_method(D_METHOD("cone_twist_joint_get_param", "joint", "param"), &PhysicsServer::cone_twist_joint_get_param); - BIND_CONSTANT(CONE_TWIST_JOINT_SWING_SPAN); - BIND_CONSTANT(CONE_TWIST_JOINT_TWIST_SPAN); - BIND_CONSTANT(CONE_TWIST_JOINT_BIAS); - BIND_CONSTANT(CONE_TWIST_JOINT_SOFTNESS); - BIND_CONSTANT(CONE_TWIST_JOINT_RELAXATION); - - BIND_CONSTANT(G6DOF_JOINT_LINEAR_LOWER_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_LINEAR_UPPER_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS); - BIND_CONSTANT(G6DOF_JOINT_LINEAR_RESTITUTION); - BIND_CONSTANT(G6DOF_JOINT_LINEAR_DAMPING); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_LOWER_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_UPPER_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_DAMPING); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_RESTITUTION); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_FORCE_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_ERP); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY); - BIND_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT); - - BIND_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT); - BIND_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_MOTOR); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_SWING_SPAN); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_TWIST_SPAN); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_BIAS); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_SOFTNESS); + BIND_ENUM_CONSTANT(CONE_TWIST_JOINT_RELAXATION); + + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_LOWER_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_UPPER_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_RESTITUTION); + BIND_ENUM_CONSTANT(G6DOF_JOINT_LINEAR_DAMPING); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LOWER_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_UPPER_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_LIMIT_SOFTNESS); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_DAMPING); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_RESTITUTION); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_FORCE_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_ERP); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_TARGET_VELOCITY); + BIND_ENUM_CONSTANT(G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT); + + BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_ANGULAR_LIMIT); + BIND_ENUM_CONSTANT(G6DOF_JOINT_FLAG_ENABLE_MOTOR); ClassDB::bind_method(D_METHOD("joint_get_type", "joint"), &PhysicsServer::joint_get_type); @@ -642,67 +643,67 @@ void PhysicsServer::_bind_methods() { ClassDB::bind_method(D_METHOD("get_process_info", "process_info"), &PhysicsServer::get_process_info); - BIND_CONSTANT(SHAPE_PLANE); - BIND_CONSTANT(SHAPE_RAY); - BIND_CONSTANT(SHAPE_SPHERE); - BIND_CONSTANT(SHAPE_BOX); - BIND_CONSTANT(SHAPE_CAPSULE); - BIND_CONSTANT(SHAPE_CONVEX_POLYGON); - BIND_CONSTANT(SHAPE_CONCAVE_POLYGON); - BIND_CONSTANT(SHAPE_HEIGHTMAP); - BIND_CONSTANT(SHAPE_CUSTOM); - - BIND_CONSTANT(AREA_PARAM_GRAVITY); - BIND_CONSTANT(AREA_PARAM_GRAVITY_VECTOR); - BIND_CONSTANT(AREA_PARAM_GRAVITY_IS_POINT); - BIND_CONSTANT(AREA_PARAM_GRAVITY_DISTANCE_SCALE); - BIND_CONSTANT(AREA_PARAM_GRAVITY_POINT_ATTENUATION); - BIND_CONSTANT(AREA_PARAM_LINEAR_DAMP); - BIND_CONSTANT(AREA_PARAM_ANGULAR_DAMP); - BIND_CONSTANT(AREA_PARAM_PRIORITY); - - BIND_CONSTANT(AREA_SPACE_OVERRIDE_DISABLED); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE_REPLACE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE); - BIND_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE_COMBINE); - - BIND_CONSTANT(BODY_MODE_STATIC); - BIND_CONSTANT(BODY_MODE_KINEMATIC); - BIND_CONSTANT(BODY_MODE_RIGID); - BIND_CONSTANT(BODY_MODE_CHARACTER); - - BIND_CONSTANT(BODY_PARAM_BOUNCE); - BIND_CONSTANT(BODY_PARAM_FRICTION); - BIND_CONSTANT(BODY_PARAM_MASS); - BIND_CONSTANT(BODY_PARAM_GRAVITY_SCALE); - BIND_CONSTANT(BODY_PARAM_ANGULAR_DAMP); - BIND_CONSTANT(BODY_PARAM_LINEAR_DAMP); - BIND_CONSTANT(BODY_PARAM_MAX); - - BIND_CONSTANT(BODY_STATE_TRANSFORM); - BIND_CONSTANT(BODY_STATE_LINEAR_VELOCITY); - BIND_CONSTANT(BODY_STATE_ANGULAR_VELOCITY); - BIND_CONSTANT(BODY_STATE_SLEEPING); - BIND_CONSTANT(BODY_STATE_CAN_SLEEP); + BIND_ENUM_CONSTANT(SHAPE_PLANE); + BIND_ENUM_CONSTANT(SHAPE_RAY); + BIND_ENUM_CONSTANT(SHAPE_SPHERE); + BIND_ENUM_CONSTANT(SHAPE_BOX); + BIND_ENUM_CONSTANT(SHAPE_CAPSULE); + BIND_ENUM_CONSTANT(SHAPE_CONVEX_POLYGON); + BIND_ENUM_CONSTANT(SHAPE_CONCAVE_POLYGON); + BIND_ENUM_CONSTANT(SHAPE_HEIGHTMAP); + BIND_ENUM_CONSTANT(SHAPE_CUSTOM); + + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_VECTOR); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_IS_POINT); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_DISTANCE_SCALE); + BIND_ENUM_CONSTANT(AREA_PARAM_GRAVITY_POINT_ATTENUATION); + BIND_ENUM_CONSTANT(AREA_PARAM_LINEAR_DAMP); + BIND_ENUM_CONSTANT(AREA_PARAM_ANGULAR_DAMP); + BIND_ENUM_CONSTANT(AREA_PARAM_PRIORITY); + + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_DISABLED); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_COMBINE_REPLACE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE); + BIND_ENUM_CONSTANT(AREA_SPACE_OVERRIDE_REPLACE_COMBINE); + + BIND_ENUM_CONSTANT(BODY_MODE_STATIC); + BIND_ENUM_CONSTANT(BODY_MODE_KINEMATIC); + BIND_ENUM_CONSTANT(BODY_MODE_RIGID); + BIND_ENUM_CONSTANT(BODY_MODE_CHARACTER); + + BIND_ENUM_CONSTANT(BODY_PARAM_BOUNCE); + BIND_ENUM_CONSTANT(BODY_PARAM_FRICTION); + BIND_ENUM_CONSTANT(BODY_PARAM_MASS); + BIND_ENUM_CONSTANT(BODY_PARAM_GRAVITY_SCALE); + BIND_ENUM_CONSTANT(BODY_PARAM_ANGULAR_DAMP); + BIND_ENUM_CONSTANT(BODY_PARAM_LINEAR_DAMP); + BIND_ENUM_CONSTANT(BODY_PARAM_MAX); + + BIND_ENUM_CONSTANT(BODY_STATE_TRANSFORM); + BIND_ENUM_CONSTANT(BODY_STATE_LINEAR_VELOCITY); + BIND_ENUM_CONSTANT(BODY_STATE_ANGULAR_VELOCITY); + BIND_ENUM_CONSTANT(BODY_STATE_SLEEPING); + BIND_ENUM_CONSTANT(BODY_STATE_CAN_SLEEP); /* - BIND_CONSTANT( JOINT_PIN ); - BIND_CONSTANT( JOINT_GROOVE ); - BIND_CONSTANT( JOINT_DAMPED_SPRING ); + BIND_ENUM_CONSTANT( JOINT_PIN ); + BIND_ENUM_CONSTANT( JOINT_GROOVE ); + BIND_ENUM_CONSTANT( JOINT_DAMPED_SPRING ); - BIND_CONSTANT( DAMPED_STRING_REST_LENGTH ); - BIND_CONSTANT( DAMPED_STRING_STIFFNESS ); - BIND_CONSTANT( DAMPED_STRING_DAMPING ); + BIND_ENUM_CONSTANT( DAMPED_STRING_REST_LENGTH ); + BIND_ENUM_CONSTANT( DAMPED_STRING_STIFFNESS ); + BIND_ENUM_CONSTANT( DAMPED_STRING_DAMPING ); */ - //BIND_CONSTANT( TYPE_BODY ); - //BIND_CONSTANT( TYPE_AREA ); + //BIND_ENUM_CONSTANT( TYPE_BODY ); + //BIND_ENUM_CONSTANT( TYPE_AREA ); - BIND_CONSTANT(AREA_BODY_ADDED); - BIND_CONSTANT(AREA_BODY_REMOVED); + BIND_ENUM_CONSTANT(AREA_BODY_ADDED); + BIND_ENUM_CONSTANT(AREA_BODY_REMOVED); - BIND_CONSTANT(INFO_ACTIVE_OBJECTS); - BIND_CONSTANT(INFO_COLLISION_PAIRS); - BIND_CONSTANT(INFO_ISLAND_COUNT); + BIND_ENUM_CONSTANT(INFO_ACTIVE_OBJECTS); + BIND_ENUM_CONSTANT(INFO_COLLISION_PAIRS); + BIND_ENUM_CONSTANT(INFO_ISLAND_COUNT); } PhysicsServer::PhysicsServer() { |