summaryrefslogtreecommitdiff
path: root/legacy/ephysics/src/lib/EPhysics.h
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2012-10-10 19:17:49 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-10-10 19:17:49 +0000
commit59cc6c6f2fd9f9c991a9d310c2dfc8576304d55c (patch)
tree1473331996adcad92099c485769fbaea9f90f996 /legacy/ephysics/src/lib/EPhysics.h
parentbdd5ba211551a4f93d64e886509ce25836f27161 (diff)
ephysics: support forces (and torques) on 3 axes
SVN revision: 77782
Diffstat (limited to '')
-rw-r--r--legacy/ephysics/src/lib/EPhysics.h48
1 files changed, 41 insertions, 7 deletions
diff --git a/legacy/ephysics/src/lib/EPhysics.h b/legacy/ephysics/src/lib/EPhysics.h
index e99fdf28e1..d49492d61d 100644
--- a/legacy/ephysics/src/lib/EPhysics.h
+++ b/legacy/ephysics/src/lib/EPhysics.h
@@ -2895,14 +2895,16 @@ EAPI void *ephysics_body_data_get(const EPhysics_Body *body);
2895 * @param body The physics body which over the force will be applied. 2895 * @param body The physics body which over the force will be applied.
2896 * @param x The axis x component of force. 2896 * @param x The axis x component of force.
2897 * @param y The axis y component of force. 2897 * @param y The axis y component of force.
2898 * @param z The axis z component of force.
2898 * 2899 *
2899 * @see ephysics_body_torque_apply(). 2900 * @see ephysics_body_torque_apply().
2900 * @see ephysics_body_force_apply(). 2901 * @see ephysics_body_force_apply().
2901 * @see ephysics_body_forces_get(). 2902 * @see ephysics_body_forces_get().
2903 * @see ephysics_body_torques_get().
2902 * 2904 *
2903 * @ingroup EPhysics_Body 2905 * @ingroup EPhysics_Body
2904 */ 2906 */
2905EAPI void ephysics_body_central_force_apply(EPhysics_Body *body, double x, double y); 2907EAPI void ephysics_body_central_force_apply(EPhysics_Body *body, double x, double y, double z);
2906 2908
2907/** 2909/**
2908 * @brief 2910 * @brief
@@ -2913,17 +2915,24 @@ EAPI void ephysics_body_central_force_apply(EPhysics_Body *body, double x, doubl
2913 * And the body will rotate around Z axis considering this angular velocity. 2915 * And the body will rotate around Z axis considering this angular velocity.
2914 * 2916 *
2915 * @param body The physics body that will receive the torque. 2917 * @param body The physics body that will receive the torque.
2916 * @param torque Torque to change angular acceleration of the body around Z 2918 * @param torque_x Torque to change angular acceleration of the body around X
2919 * axis (rotate on y - z plane).
2920 * Negative values will accelerate it on counter clockwise rotation.
2921 * @param torque_y Torque to change angular acceleration of the body around Y
2922 * axis (rotate on x - z plane).
2923 * Negative values will accelerate it on counter clockwise rotation.
2924 * @param torque_z Torque to change angular acceleration of the body around Z
2917 * axis (rotate on x - y plane). 2925 * axis (rotate on x - y plane).
2918 * Negative values will accelerate it on counter clockwise rotation. 2926 * Negative values will accelerate it on counter clockwise rotation.
2919 * 2927 *
2920 * @see ephysics_body_central_force_apply(). 2928 * @see ephysics_body_central_force_apply().
2921 * @see ephysics_body_force_apply(). 2929 * @see ephysics_body_force_apply().
2922 * @see ephysics_body_forces_get(). 2930 * @see ephysics_body_forces_get().
2931 * @see ephysics_body_torques_get().
2923 * 2932 *
2924 * @ingroup EPhysics_Body 2933 * @ingroup EPhysics_Body
2925 */ 2934 */
2926EAPI void ephysics_body_torque_apply(EPhysics_Body *body, double torque); 2935EAPI void ephysics_body_torque_apply(EPhysics_Body *body, double torque_x, double torque_y, double torque_z);
2927 2936
2928/** 2937/**
2929 * @brief 2938 * @brief
@@ -2938,15 +2947,17 @@ EAPI void ephysics_body_torque_apply(EPhysics_Body *body, double torque);
2938 * @ref ephysics_body_torque_apply(), or can be used to lead to both 2947 * @ref ephysics_body_torque_apply(), or can be used to lead to both
2939 * behaviors with @ref ephysics_body_force_apply(). 2948 * behaviors with @ref ephysics_body_force_apply().
2940 * 2949 *
2941 * It will result in a central force with force (@p x, @p y) and a 2950 * It will result in a central force with force (@p x, @p y, @p z) and a
2942 * torque that will be calculated as a cross product on force 2951 * torque that will be calculated as a cross product on force
2943 * and relative position. 2952 * and relative position.
2944 * 2953 *
2945 * @param body The physics body that will receive the impulse. 2954 * @param body The physics body that will receive the impulse.
2946 * @param x The axis x component of force. 2955 * @param x The axis x component of force.
2947 * @param y The axis y component of force. 2956 * @param y The axis y component of force.
2957 * @param z The axis z component of force.
2948 * @param pos_x The axis x component of the relative position to apply force. 2958 * @param pos_x The axis x component of the relative position to apply force.
2949 * @param pos_y The axis y component of the relative position to apply force. 2959 * @param pos_y The axis y component of the relative position to apply force.
2960 * @param pos_z The axis z component of the relative position to apply force.
2950 * 2961 *
2951 * @note Force is measured in kg * p / s / s and position in p (pixels, or 2962 * @note Force is measured in kg * p / s / s and position in p (pixels, or
2952 * Evas coordinates). 2963 * Evas coordinates).
@@ -2954,10 +2965,11 @@ EAPI void ephysics_body_torque_apply(EPhysics_Body *body, double torque);
2954 * @see ephysics_body_central_force_apply(). 2965 * @see ephysics_body_central_force_apply().
2955 * @see ephysics_body_torque_apply(). 2966 * @see ephysics_body_torque_apply().
2956 * @see ephysics_body_forces_get(). 2967 * @see ephysics_body_forces_get().
2968 * @see ephysics_body_torques_get().
2957 * 2969 *
2958 * @ingroup EPhysics_Body 2970 * @ingroup EPhysics_Body
2959 */ 2971 */
2960EAPI void ephysics_body_force_apply(EPhysics_Body *body, double x, double y, Evas_Coord pos_x, Evas_Coord pos_y); 2972EAPI void ephysics_body_force_apply(EPhysics_Body *body, double x, double y, double z, Evas_Coord pos_x, Evas_Coord pos_y, Evas_Coord pos_z);
2961 2973
2962/** 2974/**
2963 * @brief 2975 * @brief
@@ -2969,17 +2981,38 @@ EAPI void ephysics_body_force_apply(EPhysics_Body *body, double x, double y, Eva
2969 * @param body The physics body. 2981 * @param body The physics body.
2970 * @param x The axis x component of total force. 2982 * @param x The axis x component of total force.
2971 * @param y The axis y component of total force. 2983 * @param y The axis y component of total force.
2972 * @param torque The torque. 2984 * @param z The axis z component of total force.
2973 * 2985 *
2974 * @see ephysics_body_force_apply() for more details. 2986 * @see ephysics_body_force_apply() for more details.
2975 * @see ephysics_body_central_force_apply(). 2987 * @see ephysics_body_central_force_apply().
2976 * @see ephysics_body_torque_apply(). 2988 * @see ephysics_body_torque_apply().
2989 * @see ephysics_body_torques_get().
2977 * @see ephysics_body_forces_clear(). 2990 * @see ephysics_body_forces_clear().
2978 * @see ephysics_world_gravity_set(). 2991 * @see ephysics_world_gravity_set().
2979 * 2992 *
2980 * @ingroup EPhysics_Body 2993 * @ingroup EPhysics_Body
2981 */ 2994 */
2982EAPI void ephysics_body_forces_get(const EPhysics_Body *body, double *x, double *y, double *torque); 2995EAPI void ephysics_body_forces_get(const EPhysics_Body *body, double *x, double *y, double *z);
2996
2997/**
2998 * @brief
2999 * Get physics body torques.
3000 *
3001 * Get all the torques applied over a body.
3002 * Damping is not considered.
3003 *
3004 * @param body The physics body.
3005 * @param x The torque on x axis.
3006 * @param y The torque on y axis.
3007 * @param z The torque on z axis.
3008 *
3009 * @see ephysics_body_torque_apply() for more details.
3010 * @see ephysics_body_force_apply().
3011 * @see ephysics_body_forces_clear().
3012 *
3013 * @ingroup EPhysics_Body
3014 */
3015EAPI void ephysics_body_torques_get(const EPhysics_Body *body, double *x, double *y, double *z);
2983 3016
2984/** 3017/**
2985 * @brief 3018 * @brief
@@ -2999,6 +3032,7 @@ EAPI void ephysics_body_forces_get(const EPhysics_Body *body, double *x, double
2999 * @see ephysics_body_torque_apply(). 3032 * @see ephysics_body_torque_apply().
3000 * @see ephysics_body_force_apply(). 3033 * @see ephysics_body_force_apply().
3001 * @see ephysics_body_forces_get(). 3034 * @see ephysics_body_forces_get().
3035 * @see ephysics_body_torques_get().
3002 * 3036 *
3003 * @ingroup EPhysics_Body 3037 * @ingroup EPhysics_Body
3004 */ 3038 */