Start a new topic
Solved

Multi-Positionable lead to a jni error.

Fatal signal 11 (SIGSEGV) at 0x00000008 (code=1), thread 2210 (Thread-76716)

I want to update two postionables in updatePositionables like this:

std::unordered_map<std::string, wikitude::sdk_core::impl::PositionableWrapper*>::const_iterator it_3d = positionables_.find("Positionable3d");

std::unordered_map<std::string, wikitude::sdk_core::impl::PositionableWrapper*>::const_iterator it_2d = positionables_.find("Positionable2d");


It's OK.

But if I set the matrix of it_2d after update the matrix of it_3d,the error occured:


    it->second->setWorldMatrix(identity.get());

    it->second->setViewMatrix(modelViewMatrix.get());

    it->second->setProjectionMatrix(_projectionMatrix.get());

   

    // for 2d augmentations

    it_2d->second->setWorldMatrix((modelViewMatrix * _projectionMatrix).get());

    it_2d->second->setViewMatrix(identity.get());

    it_2d->second->setProjectionMatrix(identity.get());


Hi He,

could you provide your entire plugin code as well as the JavaScript code of your world for me to have a look at. The snippet you provided so far seems correct to me. So he error must lie somewhere else.

Thanks
Eva


 

OK,the plugin name is FixedPostionPlugin

There are the source code of jni and JavaScript.


zip
(26.4 KB)
js

Hello He,



The JavaScript code you provided does not define an AR.Positionable with the identifier "fixPositionable2d". Searching for it in the positionables_ container therefore gives you positionables_.end(). As you only check the first of your two iterators, the code will continue nonetheless and dereference an invalid iterator, causing a crash.


Consequently, you need to define this missing AR.Positionable for your code to work.


I've included an adapted version of the marker tracking plugin and corresponding JavaScript that uses two AR.Positionables.



Kind regards

Thomas


js
cpp
Login or Signup to post a comment