Skip to content

Commit

Permalink
Merge pull request #45 from SearchAndRescue2/feat/rotor-effects
Browse files Browse the repository at this point in the history
Add more realistic aerodynamic effects for helicopters
  • Loading branch information
hsanjuan committed Nov 28, 2023
2 parents c1ae3f7 + 6993198 commit d965676
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 73 deletions.
3 changes: 3 additions & 0 deletions src/obj.h
Expand Up @@ -961,6 +961,9 @@ typedef struct {
*/
float center_to_ground_height;

/* Rate of heading change due to torque (radians/cycle) */
float torque_velocity;


/* Moveable parts */
sar_obj_part_struct **part;
Expand Down
18 changes: 17 additions & 1 deletion src/sfm.h
Expand Up @@ -42,6 +42,18 @@
*/
#define SFMDefaultGravity 9.80665


/*
* Effective transactional lift speed value in m/s.
*/
#define SFMETLSpeed 12.35 // 24 knots

/*
* Transverse Flow Effect (TF) values in m/s.
*/
#define SFMTFStart 2.57 // 5 knots
#define SFMTFEnd 12.86 // 25 knots

/*
* Core structure:
*/
Expand All @@ -61,7 +73,11 @@ typedef struct {
SFMPositionStruct actual_wind_vector; /* In meters per Cycle */
unsigned long wind_flags;
SFMBoolean wind_enabled;
/* Callbacks, typical inputs are; realm pointer,

/* Realism setting */
SFMFlightPhysicsLevel flight_physics_level;

/* Callbacks, typical inputs are; realm pointer,
* model pointer, client data
*/

Expand Down
4 changes: 4 additions & 0 deletions src/sfmmodel.c
Expand Up @@ -297,6 +297,10 @@ SFMBoolean SFMModelChangeValues(
{
model->wingspan = value->wingspan;
}
if(flags & SFMFlagRotorDiameter)
{
model->rotor_diameter = value->rotor_diameter;
}
if(flags & SFMFlagGearState)
{
model->gear_state = value->gear_state;
Expand Down
4 changes: 4 additions & 0 deletions src/sfmmodel.h
Expand Up @@ -78,6 +78,8 @@
#define SFMFlagStopped ((SFMFlags)1 << 41)
#define SFMFlagLength ((SFMFlags)1 << 42)
#define SFMFlagWingspan ((SFMFlags)1 << 43)
#define SFMFlagRotorDiameter ((SFMFlags)1 << 44)
#define SFMFlagSingleMainRotor ((SFMFlags)1 << 45)

/*
* Flight model types:
Expand Down Expand Up @@ -148,6 +150,7 @@ typedef struct {
double service_ceiling; /* Meters. */
double length; /* Meters */
double wingspan; /* Meters */
double rotor_diameter; /* Meters */
double belly_height; /* Undercarrage to center, meters. */
SFMBoolean gear_state; /* True when down. */
int gear_type; /* One of SFMGearType*. */
Expand All @@ -165,6 +168,7 @@ typedef struct {
* ground height,
* in meters.
*/
double torque_velocity; /* Radians/cycle internal */
double heading_control_coeff; /* -1.0 to 1.0. */
double pitch_control_coeff; /* -1.0 to 1.0. */
double bank_control_coeff; /* -1.0 to 1.0. */
Expand Down

0 comments on commit d965676

Please sign in to comment.