Reputation: 1
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
Upvotes: 0
Views: 93
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