Log in or register to post comments

Crash on target lost / found continously in Vuforia sdk 2.0.31 and Unity 4.1.2

April 18, 2013 - 11:14am #1

Vuforia SDK Version: Vuforia unity sdk 2.0.31 -

Description with steps to reproduce:

Hello,

Please download the project source files from the below dropbox link. It contains the project source code files, and two text files in assets folder which explains the issue, steps to reproduce and untiy's editor log of the crash.

https://www.dropbox.com/s/a2j1cik4g8p1c24/ARGame_180413.zip
 

Below is the text copied from the "Read me" file of the project in case if you cannot download that.

====================================================================
Rigidbody null reference issue / crash, when target is lost / found continously repeatedly.
in Vuforia 2.0.31 and Unity 4.1.2

Ashish (18.April.2013)
====================================================================
    
    
>>>    ISSUE:  
--------------------------------------------------------
    This project, if you run, will let you move a ball on a plane, according to you moving your target image.
    But in Unity 4.1.2 it is crashing when the target is lost and visible repeateady quickly quickly.
    Whereas In Unity 3.5.6 is working fine.
    
    ("Repeatedly quickly quickly" means as fast as you can move in and out the image target from the camera view.
        But keep it at that pace that it should alteast be be detectable.
        In just 5-6 times of doing this, will not show you the real error or issue)
    
       
    
    
>>>    ISSUE (In details), ITS CAUSE and TEMPORARY SOLUION :-
--------------------------------------------------------
    
    1) While running the game, When the marker (trackerable image) continuesly appears and dis-appears
    in front of the camera then the game crashes in iphone, giving me some Physics (PhyX) error in XCode console.
        Below is the error give by Xcode console:
                0xc472f4:  beq    0xc47310;
                ContactMessage::onContactNotify(NxContactPair&, unsigned int) + 104 at PhysicsManager.cpp:230
    
    2) When I do this same thing in Unity 4.1.2 PRO editor itself, on my mac. Then, It quites the unity program
    itself. And when I checked the Editor log. It displayed 'Null Reference'
    
    3) When I debuged my script Ball.cs by using couple of Debug.Logs, I found that it is giving me 'null refernce'
    due to the current rigidbody object i.e my variable "_thisRigidbody"
    (i.e ball's own rigidbody, that I assign in the awake function)
    
    4) And If I comment all the two lines inside the PauseBallBehaviour() and ResumeBallBehaviour() functions.
    Then this error doesn't happens. Which makes me even more sure that my _thisRigidbody variable is giving null reference.
    
    5) SURPRIZINGLY. Its happens in unity 4.1.2 editor and xcode project build from Unity 4.1.2
    either its pro or basic.
    BUT. This issue does not happens in unity 3.5.6 editor and not even in xcode project build from Unity 3.5.6.
    
    so, does that means UNTIY 4.1.2 is having some issue ?
        or Vuforia SDK 2.0.31 is having some problem with Unity 4.1.2 ??
        or Does I am doing something wrong with rigidbody or something else ???
        
    
>>>    Note:
--------------------------------------------------------
    a) If Xcode project build, is giving you any error regarding QCAR, then manually add the "QCARUnityPlayer.h"
    to your xcode project, from Assets > Plugins > ios > QCARUnityPlayer.h
    
    b) I am using  Unity 4.1.2 + ios Basic license, Xcode 4.6.1, OSX Lion  10.7.5, ipod Touch ios 5.1.1, iphone 3gs ios 6.1.2
            
            
    I am bady before this issue to solve it. But not lucky enough to see some success.
    PLEASE REPLY ME IF YOU FIND ANY GOOD SOLUTION TO IT.  OR ANY SUGGESTION.
    
    
Thank you.
    
 

-

Development OS (Mac OS X, Windows, Linux): MAC OS X 10.7.5 -

Mobile OS and Version: ios 5.1 and ios 6.1 -

Mobile Device Manufacturer and Model name: ipod touch and iphone 3gs -

Do the Vuforia Sample Applications show the same behavior?: I cannot test this issue in any vuforia unity samples, as no sample is there which deals with rigidbodies.

Crash on target lost / found continously in Vuforia sdk 2.0.31

July 30, 2013 - 12:25am #11

Hello Friends,

I am very glad that my first Vuforia Augmented Reality Game
i.e Real Maze 3D Augmented Reality has been approved by apple and google play.

Special Thanks to @NalinS and @AlessandroB who had helped me out a serious issue some time back on the game.

And sorry for posting late, i was busy in some client project. But Finally I have it there now.

Friends, please check out my game and give me any feedback, or suggestion for that.
Download links are below:-

REAL MAZE 3D Augmented Reality    - ANDROID version
https://play.google.com/store/apps/details?id=com.mahadevinteractive.realmaze

REAL MAZE 3D Augmented Reality    - IOS version
https://itunes.apple.com/us/app/real-maze-3d-augmented-reality/id641528473?mt=8

Big Thanks to Vuforia and Cheers ;)
- Ashish
 

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 22, 2013 - 4:08am #10

Glad its working now and happy I could help :)

N

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 22, 2013 - 12:40am #9

Hi Nalin, Cheers Man! The issue seems to be fixed now.

I also think that enabling and dissabling of the colliders in the default trackable event handler was envolved in causing this crash.

I tried removing those lines, as you mentioned and then i tried testing couple of times and unity didn't crashed.

Hope so it will not even do this later. :D  For now, ofcourse this fixed the crash issue.

Thanks man! big congos.

Cheers.. again.

-ashish

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 20, 2013 - 1:25pm #8

I am wondering whether the enabling and disabling of colliders might be causing a problem in default trackabale event handler?

 

        // Disable colliders:

        foreach (Collider component in colliderComponents)

        {

            component.enabled = false;

        }

 

Might be worth experimenting here as it could be impacting the physics...

 

N

 

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 20, 2013 - 2:22am #7

Hi Nalin,  Hope you had checked my last message.

Well, I want to discuss couple of cases with you.
It is now getting more closer to the point, that it is something in vuforia unity sdk that is causing this issue (i.e destroying the rigidbody references). Because I tried all the below cases in an empty project (very quickly repeatedly again and again) and these all were working fine. But If I use any of these cases after importing the Vuforia unity sdk 2.0.31 (in a separate script OR with the DefaultTrackableEventHandler.cs) then all of these are causing the same crash ( i.e ContactMessage::onContactNotify or null reference). Where, I am not distroying  any object from my game scene.

All the cases that I tried and that failed are:
============================================
1) the one that I was doing
_thisRigidbody.useGravity = false;
_thisRigidbody.isKinematic = true;

 2) the one that you told me
this.rigidbody.useGravity = false;
this.rigidbody.isKinematic = true;

3) and third, i.e but just referring the default current rigid-body (small 'r')
rigidbody.useGravity = false;
rigidbody.isKinematic = true;

4)  and fourth, i.e the one that was mentioned in the link you shared of other topic
i.e https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/moving-object-tilting-image-target#comment-2018741
GameObject ball = GameObject.Find("Ball");
if (ball != null)
{
     Rigidbody rigidBody = ball.GetComponent<Rigidbody>();
    // Disable gravity:
               rigidBody.useGravity = false;
}
========================================

Also, at the ending of the code lines of your last post, you had written, both the useGravity and isKinematic to 'false'  in ResumeBallBehaviour() function. But in my code 'It was' and 'I need it as' isKinematic = false and useGravity = true
please once re-check that.  

My project is about 90% done and is on the same point from last 3-4 days. And I don't want to close this becuase of this unexpected crashes. Please my friend, sequeze some more info from your dev team. I hope I should prove to be doing something wrong somewhere, but hope could get this issue resolved as soon as possible.

Will wait for your reply.

-ashish
 

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 20, 2013 - 12:46am #6

Hi Nalin,  Well the crash is still there with what you told me to try out.  (i.e this.rigidbody)

but thanks for checking in and atleast trying it out.  :)

And, why I was caching the rigidbody into a private variable, because it was mentioned in unity's performacne optimization docs, and is a way to increase the performace of your game by chaching any component that you access frequently into a local variable. This will in-turn reduce the component lookup and thus will increase the performance.
You can check it in the point number # 3 at below unity docs:
http://docs.unity3d.com/Documentation/ScriptReference/index.Performance_Optimization.html

Also, upto what I got from the other topic that you refered in the last post, is that, that one is really very close to this thing, but it not dealing with any crash or un-realistic behavioiur. But is more focused on the centering of the gravity and dealing that with two markers or using the world center mode.

Please check with your colleagues  if , they might had faced the same issue or could guide us with some more info... :)
- ashish

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 19, 2013 - 10:33am #5

When I ran the code as is it crashed.  However it's nothing to do with Vuforia.

It seems you are using a hack to pause the rigidbody (ball).

However I do not know why you are binding the components to your own variables like this:

 

_thisRigidbody = rigidbody;

 

...as it is completely unecessary, and I have not seen it recommended anywhere.

 

Instead it is best to refer to the rigidbody of the current component using this:

 

this.rigidbody.

 

When I updated the code accordingly, as below,  I did not see any crash, so it is something you might like to try.

If it does not crash for you, then I suspect it might be something to do with the temporary variables you introduced along with how Unity might be handling the managed code.  If it still crashes, then it is probably something to do with ruining the integrity of the Physics Engine so you may have to find an alternative way of pausing the app.

It is also worth experimenting with a few tutorial to get the hang of the physics, particularly when it comes to Vuforia.  Also I recommend checking out this thread as it describes step by step instructions to achieve the type of thing you are after:

https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/moving-object-tilting-image-target

HTH

N

 

 

 

public void PauseBallBehaviour()

{

Debug.Log("-------> In Ball.cs - PauseBallBehaviour() line 84");

 

this.rigidbody.useGravity = false;

this.rigidbody.isKinematic = true;

 

Debug.Log("-------> In Ball.cs - PauseBallBehaviour() line 87");

}

 

public void ResumeBallBehaviour()

{

Debug.Log("-------> In Ball.cs - ResumeBallBehaviour() line 92");

// _thisRigidbody.isKinematic = false; // 3### COMMENT THIS AND OTHER LINES and you will see the Unity crash issue will fix automatically. But I need these lines.

// _thisRigidbody.useGravity = true; // 4### COMMENT THIS AND OTHER LINES and you will see the Unity crash issue will fix automatically. But I need these lines.

 

this.rigidbody.useGravity = false;

this.rigidbody.isKinematic = false;

 

Debug.Log("-------> In Ball.cs - ResumeBallBehaviour() line 95");

}

 

 

 

 

 

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 19, 2013 - 7:23am #4

Thanks Nalin.

Will wait for your response. and also will reply if i found something interesting.

Appreciate very much.

-Ashish

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 19, 2013 - 7:14am #3

Ok I will try to take a look today.

N

Crash on target lost / found continously in Vuforia sdk 2.0.31

April 19, 2013 - 4:52am #2

Hi

Anybody from VUFORIA DEVELOPMENT TEAM.  Please help me address the above crash issue.

Thanks

Log in or register to post comments