Katamari Knockoff - Working Title

Weird Stretchy Problem on Instantiate > SetParent with Prefabs

https://answers.unity.com/questions/868484/why-is-instantiated-objects-scale-changing.html

I encountered a strange stretching problem when objects were made using Instantiate/SetParent. It turns out this is a change in unity 5.5 where a bool is needed with SetParent.

Problem:

instance.transform.SetParent(transform);

No problem:

instance.transform.SetParent(transform, false);

Moving things to the player once they’ve stuck

Random.onUnitSphere doesn’t do what I want

It makes things crazy instead.

2018/12/06/crazy_things.gif

Physics.ClosestPoint seems to almost do what I want.

2018/12/06/physics_closest_point.gif

Now to only have it operate on things stuck to the player.

I added this to control attachment behavior:

using System.Collections;
using UnityEngine;

public class ThingToggler : MonoBehaviour {
    public bool attached = false;
}

Now in PlayerController.DoPickup:

other.gameObject.GetComponent<ThingToggler>().attached = true;

Then in ThingCondenser:

if (!GetComponent<ThingToggler>().attached) {
    return;
}

Finally, I attached ThingCondenser and ThingToggler to all of the flower prefabs, and we’re in business.

2018/12/06/working_as_intended.gif

More things

Sticky microphones.

2018/12/06/sticky_microphones.gif

Microphone bowling.

2018/12/06/microphone_bowling.gif