Question by
Drasek · Jun 10, 2017 at 07:51 AM ·
objectsfollow playerfloating
Floating Object
Hi, I made simple simple code, with two objects, where one object is following another. The object I am controling scales up overtime but the second object that sould follow always starts floating above ground, probably following the center of first object, is there anything to fix it. I am using following code:
Scaling: player.transform.localScale = player.transform.localScale + new Vector3(0f, 0.1f, 0f);
Movement: dir = player.position - transform.position;
transform.Translate(dir.normalized * 2f*Time.deltaTime, Space.World);
transform.LookAt(player);
Comment