Hi,
Happy Belated Solstice!
I have a projectile that I want to attach to another object when they collide. I’m attempting to do this by parenting the projectile to the target object. I can see in the Hierarchy view that it does indeed get parented, but the geometry of the projectile, which is a sphere, gets squished (as shown below - the cylinder is the target/parent object). I can see in the inspector that the Scale of the projectile has been changed so that is no longer a sphere. Here’s my code:
if (objectHit.tag == "Socket") {
BulbSocketController socketController = objectHit.GetComponent<BulbSocketController>();
if (!socketController.HasBulb) {
this.rigidbody.velocity = Vector3.zero;
this.rigidbody.isKinematic = true;
this.transform.parent = objectHit.transform;
socketController.HasBulb = true;
}
}
If I comment out this line:
//this.transform.parent = objectHit.transform;
the sphere is not squished. Any idea what I’m doing wrong?
Thanks for your help!
Mal