I do not quite understand of course the crux of the problem, it would be nice if you describe in more detail, and lay out code which does this operation.
But at first glance, this problem can be solved Corotenol
If you don't know what it is, here's an article Article
And describe in detail, you have the operation is being invoked every frame? or after a while?It's all pretty important)