Jump to content

[SOLVED] Emmiter crash


photo

Recommended Posts

Hello, I got problem in this code:

void AppWorldLogic::doPlayLoadAnimation(float frameNumber)
{
    const int animLayer(0);
    const float soilSpillingBeginFrameNumber = 180.f;
    const float soilSpillingEndFrameNumber = 250.f;
    const float soilFenceBeginFrameNumber = 55.f;
    const float soilFenceEndFrameNumber = 90.f;
    assert(m_animationNode);

    const int numFrames(m_animationNode->getNumFrames(animLayer));

    const float prevFrame(fmod(m_animationNode->getFrame(animLayer), numFrames));

    const bool soilFence =
        prevFrame >= soilFenceBeginFrameNumber && prevFrame <= soilFenceEndFrameNumber;
    m_isSoilSpilling =
        prevFrame >= soilSpillingBeginFrameNumber && prevFrame <= soilSpillingEndFrameNumber;

    // Switch dust on if soil fence or soil splling.
    if (soilFence || m_isSoilSpilling)
    {
        if (!m_soilRock->isEnabled())
        {
            m_soilRock->setEnabled(true);
        }
        if (!m_soilRock->isEmitterEnabled())
        {
            m_soilRock->setEmitterEnabled(true);
        }
        m_shovelRocksRootNode->setEnabled(false);
    }
    else
    {
        if (m_soilRock->isEmitterEnabled())
        {
            m_soilRock->setEmitterEnabled(false);
        }
    }

    // Switch on shovel rocks between soil fence ends and soil spilling begin.
    if (prevFrame >= soilFenceEndFrameNumber && prevFrame <= soilSpillingBeginFrameNumber)
    {
        m_shovelRocksRootNode->setEnabled(true);
    }

    // Call this method to avoid crash.
    m_animationNode->getFrame(animLayer);

    m_animationNode->setFrame(animLayer, frameNumber);

    const float newFrame(fmod(m_animationNode->getFrame(animLayer), numFrames));
}

When I try to enable m_soilRock I get an assert message (stacktrace attached):

Assertion failed: index < size_t(length) && "Vector::operator[]: bad index", file D:\BA\work\214de2b1df7f6eca\include\UnigineVector.h, line 977

Без имени.png

 

 Here is node declarations:

class AppWorldLogic : public Unigine::WorldLogic
{
    Unigine::MaterialPtr m_flasherMaterial;
    Unigine::MaterialPtr m_lightMaterial;
    Unigine::ObjectMeshSkinnedPtr m_animationNode;
    Unigine::ObjectParticlesPtr m_soilRock;
    Unigine::ObjectMeshStaticPtr m_shovelEmmiter;
    Unigine::WorldTransformBonePtr m_shovelRoot;
    Unigine::NodePtr m_lightsRootNode;
    Unigine::NodePtr m_shovelRocksRootNode;

    bool m_playAnimation = false;
    bool m_isSoilSpilling = false;

    void doPlayLoadAnimation(float frameNumber);

public:

...

 

And here is method call:

int AppWorldLogic::update()
{
    auto lastframe = Unigine::Game::getIFps();
    doPlayLoadAnimation(
        m_animationNode->getFrame(0) + lastframe * 10);
    return 1;
}

 

Does anyone know where to look for the problem?

Link to comment

Hello!

In terms to be able to reproduce the issue on our side could you please specify which SDK version you are currently using? Would it be possible for you to create a simple scene to accelerate the process of iterating over the problem?

Thanks!

Link to comment

Hello!

Thank you for sharing the video, but unfortunately it did not provide much help as it simply displayed the same information as the previously shared with screenshots. Despite this, we give an attempt to reproduce the issue on our side according on snippets you shared but without any success at the moment since it's works as expected now. Please see video attached.

Based on the video your shared it appears that the crash occur immediately when the soil is loaded into the bucket animation. We suspect that the problem may be related to the enabling or disabling of the "m_shovelRocksRootNode->setEnabled(false)" and "m_shovelRocksRootNode->setEnabled(true)" nodes. However, we do not have a clear understanding of how these nodes affect the hierarchy and updates as there is no information available about where they are used.

We suggest you to try commenting out the code section marked in the image below as that may resolve the issue. Otherwise, we kindly request you to send us a simple scene that can be used to reproduce the issue on our side.

image.png

Thanks!

Link to comment

The line of code you specified is responsible for enabling/disabling the node not associated with the emitter. Commenting out this line does not change the situation.
Could you please provide a place on the cloud storage where I could upload my project?

Link to comment
33 minutes ago, Denis.Brechka said:

The line of code you specified is responsible for enabling/disabling the node not associated with the emitter. Commenting out this line does not change the situation.
Could you please provide a place on the cloud storage where I could upload my project?

You can upload your project (please zip it with no compression) to our FTP or any other file-hosting service. You can send me PM with a link to the archive.

Our FTP server credentials:

Thanks!

Link to comment

Hello!

Thank you for providing the sample. We have reviewed the project and discovered an issue with the 2.13.1 release on the engine side that cannot be quickly fixed. However, there is solution available that will prevent the behavior you experienced now.

Please find the "AppSystemLogic.cpp" source attached to this message and use it to replace the original one. To address the issue you will need to set the "PseudoParent" component on the "Shovel_Emitter" node and rebuild the application.

Thanks!

AppSystemLogic.cpp

Link to comment
  • bmyagkov changed the title to [SOLVED] Emmiter crash
×
×
  • Create New...