"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

How to reduce jitter with custom code

I am currently trying to implement a buffer window/tollerance for the 3d object movement in my scene. I just upgraded Unity to 2017.2.0f3 to see if the version built into Unity would not have so much jitter at times, but I seem to still be seeing the same issue. It seems that when lighting is perfect, the model is pretty solid.  However when I get into lower light or step further back, the 3d model starts shaking at small amounts. 

What I wanted to try to do is create a script that I can add in between the ImageTarget and the 3D model that will allow me to lets say lower the rotation/position accuracy from 7 decimal places to 2. This would allow me to minimize the shake.  I was also thinking that I might be able to use Slerp to perform any positional/rotational adjustments as well if needed, but currently I just want to be able to override the position to stop the shake and create almost a tollerance I can adjust.

So my model is a shelf. When I create a GameObject with an ImageTarget and the Shelf as children, if I add the script to the shelf and have it mirror the imageTarget's position, I seem to get the result I want.  However none of the marker tracking really works. If I rotate around the marker it does not work correctly.

Now if I set the shelf model under the ImageTarget, tracking works correctly but regardless of what position adjustments I make in the script, it doesnt even modify the position or rotation at all.  Ofcourse with this setup I also get the jitter.

So I was hoping that there might be a way of adding a custom script that will allow me to slightly adjust the rotation and position that the Vuforia ImageTarget sets to the model. Any kick in the right direction or info one might be able to provide would be greatly appreciated.  Thanks!

I have included a sample of the script below just for reference. I have been trying a number of variations, but below is an idea of what I was trying to do.

using System.Collections; using System.Collections.Generic; using UnityEngine; using System;

public class target_smooth : MonoBehaviour {     public Transform target;     public float smoothTime = 0.3F;     public Vector3 velocity = Vector3.zero;     public GameObject imageTargetObj;     public float xOffset = 0f;     public float yOffset = 0f;     public float zOffset = 0f;

    // Use this for initialization     void Start () {         imageTargetObj = GameObject.Find("ImageTarget");         target = imageTargetObj.transform;     } // Update is called once per frame void Update () {         target = imageTargetObj.transform;         Vector3 targetPosition = new Vector3((float)Math.Round(target.position.x + xOffset, 2),                                                                     (float)Math.Round(target.position.y + yOffset, 2),                                                                     (float)Math.Round(target.position.z + zOffset, 2));                 transform.parent.transform.position = targetPosition;     } }

It seems that if I put my adjustment logic in LateUpdate rather than Update itself, I am able to have the control that I was looking for. This was the main issue I had in that my modifications I was making weren't able to override Vuforias update.