Skip to content

Commit

Permalink
Fix Bug #786 (#877)
Browse files Browse the repository at this point in the history
Add a property to control the AGL raycast vertical offset, otherwise the aircraft can sink in ground at Trim time
  • Loading branch information
AlbanBERGERET-Epic authored Apr 4, 2023
1 parent 96276a5 commit 4f3c0e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ double UJSBSimMovementComponent::GetAGLevel(const FVector& StartECEFLocation, FV
// Compute the raycast Origin point
FVector StartEngineLocation;
GeoReferencingSystem->ECEFToEngine(StartECEFLocation, StartEngineLocation);
FVector LineCheckStart = StartEngineLocation + 200 * Up; // slightly above the starting point
FVector LineCheckStart = StartEngineLocation + AGLThresholdMeters * 100 * Up; // slightly above the starting point

// Compute the raycast end point
// Estimate raycast length - Altitude + 5% of ellipsoid radius in case of negative altitudes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ class JSBSIMFLIGHTDYNAMICSMODEL_API UJSBSimMovementComponent : public UActorComp
bool DrawDebug = true;


/**
* When querying for the Above Ground Level, JSBSim can throw raycasts from several points, sometimes under the StructuralFrameOrigin.
* By doing that, some of them can fail if they start below the ground. This value is a vertical offset added to each AGL Query to make sure we hit the ground.
* (Aircraft geometry is of course ignored during the process - 15m should be sufficient for all kind of aircrafts - Issue #786)
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Model|Settings")
float AGLThresholdMeters = 15;

/**
* Center of Gravity Location in Actor local frame
*/
Expand Down

0 comments on commit 4f3c0e6

Please sign in to comment.