Skip to content

Commit

Permalink
Added the ability to dynamically change thrusters location via proper…
Browse files Browse the repository at this point in the history
  • Loading branch information
hitchcock9307 authored May 1, 2024
1 parent d4f85bc commit c67311c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/models/propulsion/FGForce.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ class JSBSIM_API FGForce : public FGJSBBase
inline void SetLocationX(double x) {vXYZn(eX) = x; vActingXYZn(eX) = x;}
inline void SetLocationY(double y) {vXYZn(eY) = y; vActingXYZn(eY) = y;}
inline void SetLocationZ(double z) {vXYZn(eZ) = z; vActingXYZn(eZ) = z;}
inline double SetActingLocationX(double x) {vActingXYZn(eX) = x; return x;}
inline double SetActingLocationY(double y) {vActingXYZn(eY) = y; return y;}
inline double SetActingLocationZ(double z) {vActingXYZn(eZ) = z; return z;}
inline void SetActingLocationX(double x) {vActingXYZn(eX) = x;}
inline void SetActingLocationY(double y) {vActingXYZn(eY) = y;}
inline void SetActingLocationZ(double z) {vActingXYZn(eZ) = z;}
inline void SetLocation(const FGColumnVector3& vv) { vXYZn = vv; SetActingLocation(vv);}
inline void SetActingLocation(const FGColumnVector3& vv) { vActingXYZn = vv; }

Expand Down
13 changes: 13 additions & 0 deletions src/models/propulsion/FGThruster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ FGThruster::FGThruster(FGFDMExec *FDMExec, Element *el, int num ): FGForce(FDMEx
string property_name, base_property_name;
base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNum);

property_name = base_property_name + "/x-reference-position";
PropertyManager->Tie(property_name.c_str(), (FGForce*)this, &FGForce::GetLocationX);
property_name = base_property_name + "/y-reference-position";
PropertyManager->Tie(property_name.c_str(), (FGForce*)this, &FGForce::GetLocationY);
property_name = base_property_name + "/z-reference-position";
PropertyManager->Tie(property_name.c_str(), (FGForce*)this, &FGForce::GetLocationZ);
property_name = base_property_name + "/x-position";
PropertyManager->Tie(property_name.c_str(), (FGForce*)this, &FGForce::GetActingLocationX, &FGForce::SetActingLocationX);
property_name = base_property_name + "/y-position";
PropertyManager->Tie(property_name.c_str(), (FGForce*)this, &FGForce::GetActingLocationY, &FGForce::SetActingLocationY);
property_name = base_property_name + "/z-position";
PropertyManager->Tie(property_name.c_str(), (FGForce*)this, &FGForce::GetActingLocationZ, &FGForce::SetActingLocationZ);

element = thruster_element->FindElement("pointing");
if (element) {

Expand Down

0 comments on commit c67311c

Please sign in to comment.