Help: To stick instantiate gameobject to paddle

hi community, i’m still develop my block breaker game and this time i want to stick my sword to my paddle how can i do?

One way to make gameobject A to appear attached with gameobject B is to set B as the parent of A. After parenting moving B will cause A to move along as well.

//Assuming both gmoA and gmoB are variables of type GameObject...
// you would set gmoB  as the parent of gmoA  doing something like :
gmoA.transform.parent = gmoB.transform;
1 Like

You could also create a bool that would track if the ball isAttached and then fix a position relative to the paddle transform.

Something like this:

If (isAttached)
{

Transform.position = paddle.transform.position + new Vector3(x,y,z);

}

This topic was automatically closed after 23 hours. New replies are no longer allowed.

Privacy & Terms