Sam Munir
Sam Munir

Reputation: 1

vuforia-ball keeps falling down although it's child of imageTarget and target is not detected

I'm trying to make a tilt maze. But as soon as I hit play I can see the ball position continously changing although the target has not been detected yet. Which results in no ball when the target is detected and the maze loads up on the imageTarget.

If I check is Kinematic in the sphere(ball) rigidbody settings then the ball initiliazes with the model when target is detected but it stays at it's position until I uncheck is Kinematic and then the ball drops on the maze and moves as intented.

My sphere settings and maze floor settings are as follows

Ground properties

sphere properties

Upvotes: 0

Views: 93

Answers (1)

Horothenic
Horothenic

Reputation: 678

You can modify the DefaultTrackableEventHandler script as a workaround for that misbehavior.

There is the OnTrackingFound and OnTrackingLost events.

You can simply add something like this to the OnTrackingFound event to fix it:

MyBallScript ball = GetComponentInChildren <MyBallScript> ();

if (ball != null)
{
    ball.rigidbody.isKinematic = true;
}

And do the same to reset the ball to any position you want in OnTrackingLost event, don't forget to make it kinematic again also.

Upvotes: 1

Related Questions