Question by
Charty · Jul 19, 2016 at 08:51 PM ·
instantiatetransform
Instantiate Spawns Object Away from Source?
So what I'm trying to do is spawn a prefab of smaller cubes onto the exact same position and rotation of a big cube so it 'breaks apart'. When I hit space, the big cube disappears as intended, but the smaller cubes instantiate from a distance.
Here's a .gif of what is happening.
void Update () {
if (Input.GetKeyDown("space"))
{
Instantiate(explo, gameObject.transform.position, gameObject.transform.rotation);
explo.localScale = transform.localScale;
Destroy(gameObject);
}
Debug.Log("The Rotation");
Debug.Log(explo.transform.rotation);
Debug.Log("The Position");
Debug.Log(explo.transform.position);
}
Debug Log:
The Rotation
(0.0, 0.0, 0.0, 1.0)
The Position
(-5.5, -2.4, 3.5)
This is an extremely simple script and I've spent 2 days trying to find a similar problem to mine, but they all include Quaternion, which is not similar to my problem.
Comment