Solved my jerky, jumping movement of game objects

Hi All
After a year of intense frustration and reading posts from you all I have managed to get to the bottom of why my objects had a stutter when moved across the screen.
Why am I posting this?
Well, during my travels through the Unity posts, I noticed that I am/was not alone with this problem, so if this helps others then it is worth the time to write this post.
So first what was the problem?
In editor and in final build, objects would have a jolt in movement every few seconds.
The camera is fixed with a script on the moving object such as …

var Speed = -4.0;
var DestoyObjectTime : float = 6.0;
private var blockFlag = true;

function Start()
{
yield WaitForSeconds(1);
}

function FixedUpdate ()
{
if (blockFlag)
{
DestroyTimer();// start destroy timer
}
}

function Update ()
{
if (GameObject.Find(“DieFlag”) !=null)
transform.position += transform.forward * Time.deltaTime * Speed; //move transform
}

function DestroyTimer()
{
blockFlag = false;
yield WaitForSeconds(DestoyObjectTime);
if (GameObject.Find(“DieFlag”) !=null)
{
Destroy (gameObject);
}
}

The object (with this script attached) is spawned from another script, hence the find commands for reference to the mortality of the main character. You can see the function update is very simple and consistent in its routine timing.

Still I had this stutter/jerk in the movement, I tried it on two Macs and two PC’s and in build on all iPhones and iPads, still the same problem, I tried every combination of Update functions and played with deltaTime, I reduced my moving objects to no textures, but yes still the same problem.
I have two games in the very final testing stages but this problem was stopping the release and the fact that I have to go pro version next week.

How did I find and sort the problem…

A few days ago I thought that it is time to go pro and I don’t mean walking the streets at night.
I had read about the Profiler option and thought that I would give it a try.
This showed a spike every time that the spawned object (the one with the above code attached) was instantiated into the scene.
It showed 94% every couple of seconds and peaks matched to the timing of the jolt in movement.
The 94% was showing on the BAKE SCALED MESH PHYSX COLLISION DATA. without the pro version trial I would have never known this.
I then searched the net and found Gshape Games (Thank you) and there it was the answer:p

1, “Having an object with a mesh collider scaled at something other than <1, 1, 1>”.
2, “Moving an object that is marked STATIC”
3, “Moving object with a mesh collider that is not marked CONVEX”

In my case 1 and 2 were the case.
When you import the fbx and tick the collider option it puts on a mesh collider and leaves the convex option un selected.
I corrected the above with all my spawned objects by changing the colliders to other types due to all of my objects being scaled after imported.
Beware the problem still looks the same in editor but in builds on all devices it was fantastic not one jerk,stutter or jolt FANTASTIC

Just these 3 simple rules and the transformation is chalk and cheese.

All I need to do now is pay for Unity Pro and the games will be on the app store before Christmas.

Merry Christmas to you all and I hope that this post helps others with the same frustration.

iPhone Deano

var Speed = -4.0;
var DestoyObjectTime : float = 6.0;
private var dTime : float = 0.020; // default start
private var blockFlag = true;
private var maxdelta = 0.025;
private var corrdelta = 0.025;

function Start()
{
yield WaitForSeconds(1);
}

function FixedUpdate () 
{
if (blockFlag)
{
DestroyTimer();// start destroy timer
}	
}	

function Update ()
{
if (GameObject.Find("DieFlag") !=null)
transform.position += transform.forward * Time.deltaTime * Speed;	//move transform	
}



function DestroyTimer()
{
blockFlag = false;
yield WaitForSeconds(DestoyObjectTime);
if (GameObject.Find("DieFlag") !=null)
{
Destroy (gameObject);
}
}

First off, and secondly , wrong section this is scripting

Keithsoulasa, part of it is scripting, but if you actually read the post you would realize the solution is not.

@OP it’s great you found the problem. Thanks for the headship of the solution. This is one of those instances where pro is extremely helpful for integral game features that couldn’t have been fixed without it, rather than visuals.

To further your post…

  1. You should avoid using MeshColliders for anything you intend to move
  2. If you have to move them, they must be convex.
  3. You should always have a rigidbody on any moving collider

Most of this can be found here:

I my case I have issue wiht option 1 and 3. in my game I have curvy ground blocks to walk player in world. Each base gound has mesh collider and it’s not marked as “CONVEX”. As I mark it’s “CONVEX” curve is goes and player will move only cross point. but still I want to placing each ground block randmally to create endless enevironment.

I have stuck with this issue, this issue even create very high profile pick for iPad 3rd Gen. when it’s happen game lags all device iPad 3rd Gen or older.

pls help if any have to solution