- Home /
Instantiate a prefab at a given point and rotation
So I want to instantiate a prebab at position (-78,1,65) with rotation (0,180,0).
I am using Instantiate(arrowPrefab, transform.position, transform.rotation);
How can I legally substitute these values into a C# script?
Answer by Mike 3 · Mar 17, 2011 at 02:43 PM
Like so:
Instantiate(arrowPrefab, new Vector3(-78, 1, 65), Quaternion.Euler(0, 180, 0));
The stories of $$anonymous$$ike will live on forever!
Yes, $$anonymous$$ike will also live forever! $$anonymous$$ike is immortal!
Answer by shadowpuppet · Jan 25, 2017 at 02:22 PM
ok, I want something similar and tried to adapt this. I want the instantiate prefabs translation but no rotation at all. When I toss a grenade it rolls so when it explodes and leaves the prefab decal of scorched earth, the decal I want where the grenade blew up but not it's rotation as it leaves the decal tilted all which way but flat
oh, Instantiate(decal, transform.position, Quaternion.Euler (90,0,0)); that was easy