Hi guys!
I have a little problem with my script which consists to make a kind of plateform.
This script allows an object to move (like Sinusoïdal behavior, or Linear…), and if another object comes on this one, it will have exactly the same movement.
Here is the script which makes the plateform and objects on this one moving Linearly :
float prevX = this.sens * this.speed * Time.deltaTime;
gameObject.transform.Translate(prevX,
prevX * this.coeficientA,
0, Space.World);
foreach (GameObject it in this.objOnPlateForme)
{
it.transform.Translate(prevX,
prevX * this.coeficientA,
0, gameObject.transform);
}
this.sens represents the direction of the plateform movement (-1 or 1), this.speed the speed of the plateform and this.objOnPlateForme the container which contains the objects.
The problem is that the object of the container doesn’t move exactly like the plateform. I don’t really understand because the value of X and Y are exactly the same, but the objects on it move little bit slower than the plateform.
Do any one know an issue?