Project HR1 Development Thread (mostly questions from a newbie)

Matias Saibene

Developing and CMakin'
Joined
Jul 7, 2012
Messages
1,100
Reaction score
722
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Dear friends of the Orbiter Forum,
I recently started developing a small project called HR1 (which stands for Hirundo Rustica 1). It is a ship to fly for fun, nothing serious or professional.

While I really enjoy the development, I nevertheless have some questions that my mind (despite researching documentation) and ChatGPT can't solve. That's why if you have some free time, I suggest you help me with little questions about Orbiter's code or functions.

I have opened a code repository for this project and it can be found here: https://github.com/MatiasSaibene/HR1_orbiter_addon

Thanks in advance, Matías.
 

Matias Saibene

Developing and CMakin'
Joined
Jul 7, 2012
Messages
1,100
Reaction score
722
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
I have a problem with my code:
I'm doing a contrail effect at Mach 1. But the effect doesn't turn off when exiting Mach 1 (whether accelerating or decelerating).

You can test what I'm talking about by downloading my HR1 v0.1 here: https://github.com/MatiasSaibene/HR1_orbiter_addon/releases/tag/v0.1

This is my code:

C++:
void HR1::SndBarrierEffect(double simt){
    //double machnumber = GetMachNumber();
    double airspeed = GetAirspeed();

    if((airspeed >= 340) && (airspeed <= 350)){
        //Sound speed barrier visual effect
        static PARTICLESTREAMSPEC soundbarrierpart = {
        0, 5.0, 16, 200, 0.15, 1.0, 5, 3.0, PARTICLESTREAMSPEC::DIFFUSE,
        PARTICLESTREAMSPEC::LVL_PSQRT, 0, 2,
        PARTICLESTREAMSPEC::ATM_PLOG, 1e-4, 1};
        static VECTOR3 pos = {0, 2, 4};
        static VECTOR3 dir = {0, 1, 0};
        static double lvl = 0.1;
        AddParticleStream(&soundbarrierpart, pos, dir, &lvl);
    } else {
        DelExhaustStream(&soundbarrierpart);
    }
}

located at line 365 in HR1_orbiter_addon/Windows/HR1.cpp
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,759
Reaction score
2,508
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
You create a new Particle Stream every timestep and delete only the last of it (every time step). Better solution: Create a ParticleStream once that is tied to a double variable and make its value a function of your effect visibility. See 17.57.3.13 in the Orbiter 2016 API Reference PDF.

1693466216571.png
 

Matias Saibene

Developing and CMakin'
Joined
Jul 7, 2012
Messages
1,100
Reaction score
722
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
You create a new Particle Stream every timestep and delete only the last of it (every time step). Better solution: Create a ParticleStream once that is tied to a double variable and make its value a function of your effect visibility. See 17.57.3.13 in the Orbiter 2016 API Reference PDF.

View attachment 34802
Thanks, it worked perfect!:
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,759
Reaction score
2,508
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Try to refrain from using ChatGPT ; we all learn from our own mistakes, but we gain nothing from the ones it makes
:)

I agree, also, for the sake of the community (and if you believe into the agile manifesto), its better to get into human interactions for solving your problem. We gain nothing by everybody talking to a computer.
 

Matias Saibene

Developing and CMakin'
Joined
Jul 7, 2012
Messages
1,100
Reaction score
722
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
That's a wild takeoff, the guy in the DG must have shat himself 😱
Try to refrain from using ChatGPT ; we all learn from our own mistakes, but we gain nothing from the ones it makes
Keep it up :)
Thanks for your suggestions and humor.
I tell you that what I use from ChatGPT is very little, I never copy and paste ChatGPT code because what it produces has errors. For example, sometimes the AI invents variables.
What I do use from ChatGPT are small code fixes because sometimes I make logic errors and it's hard for me to see them.

I agree, also, for the sake of the community (and if you believe into the agile manifesto), its better to get into human interactions for solving your problem. We gain nothing by everybody talking to a computer.
I'm more than okay with that, in fact my goal with this thread is also to record mistakes I made and how I fixed them.
If everything goes well and my three projects (Luna3, HR1, XB-70 Valkyrie) come out with acceptable results, I'm going to publish a new thread with a basic course on how to make a ship for Orbiter, from modeling to Visual Studio configuration, also going through Linux development.
 
Top