Help! How to Return Original Value of a Method Bound with Update Function.

AmateurHacker

Platinian
I'm using the code below to change the camera angle, and it works fine. The original Field of View Float value is 30.0. I change it to 12.0, and it works. But when I close the tool, I want the value to return to its original value. In short, when the tool is open, it returns a float of 12.0. When the tool is closed, it should return a float of 30.0. In other words, it should return its original value.


1754411254280.png

It should get the original value when Toogle is closed.
What should I add to my code for this?











bool FielofViews;

void (*SetCameraFov)(void* instance,float fieldOfView);
void (*old_Update)(void* instance);
void new_Update(void* instance) {
if (instance != nullptr) {
if (FielofViews) {

SetCameraFov (instance,16.0);
}

}

old_Update(instance);
}
 
C++:
bool FielofViews;
void (*SetCameraFov)(void* instance,float fieldOfView);
void (*old_Update)(void* instance);
void new_Update(void* instance) {
    if (instance != nullptr) {
        if (FielofViews) {
            SetCameraFov (instance,16.0);
        } else {
            SetCameraFov (instance,30.0);
        }
    }
    old_Update(instance);
}
 
C++:
bool FielofViews;
void (*SetCameraFov)(void* instance,float fieldOfView);
void (*old_Update)(void* instance);
void new_Update(void* instance) {
    if (instance != nullptr) {
        if (FielofViews) {
            SetCameraFov (instance,16.0);
        } else {
            SetCameraFov (instance,30.0);
        }
    }
    old_Update(instance);
}
I already solved this problem. A new problem has arisen. There are multiple camera instances in setcamerafov. I only want to rotate the second one. Its float value is 30.0f. How can I select it so that it only rotates the second one?
The camera I'm trying to change is always listed second in this section, and its value is 30.0f. Is it possible to change only this camera? How can I access it?





1754558249829.png
 
Back
Top Bottom