due to warping issues, all my cubes have a scale 1 parent. i need them to be able to be parented by their parent transform so they wont warp horribly when unparented.
i also need to make them stack them neatly on their X position value when landing over other cubes, i tried this
void OnCollisionStay2D(Collision2D other)
{
if (other.transform.tag != "Player")
if (other.transform.parent.transform.parent == null)
other.transform.parent.transform.parent = transform;
if (other.transform.tag == "Cube")
other.transform.position.Set(other.transform.position.x, transform.position.y, transform.position.z);
}
But it is simply not working, nada no cube is moving or changing positions. i also tried
other.transform.parent.transform.position.Set(other.transform.position.x, transform.position.y,transform.position.z) ;
alone yet again it doesn't work as i intend it to. any suggestions ? , im at a loss here.
↧