- Home /
Instantiate with Object Rotation *180 (Rotation Offset)
i know how to give Offsets to positions and i know how to use the object's rotation to instantiate, but how can i use its rotation + (0,180,0) ? (turned around)
Very Simple Question that i cant figure out....
Answer by AurimasBlazulionis · Nov 17, 2016 at 06:42 PM
Also there is another way of doing this. You can multiply by 180 degrees during instantiation so everything will happen before the awake methods get called on the object:
GameObject.Instantiate (prefab, transform.position, transform.rotation * Quaternion.Euler (0f, 180f, 0f));
Im pretty sure i once tried the exact same thing... but oh well... that's pretty much what i wanted, thanks!
Hello from french,
Thank you 4 years later . you help me ^^
A nice day.
Answer by JoshDangIt · Nov 17, 2016 at 06:31 PM
GameObject.Instantiate (prefab, transform.position, Quaternion.Euler(0f, 180f, 0f));
EDIT: Reread your question, is this what you want?
GameObject g = GameObject.Instantiate (prefab, transform.position, prefab.transform.rotation) as GameObject;
g.transform.Rotate (0f, 180f, 0f);
Your answer
Follow this Question
Related Questions
Is there a way to set the current rotation of an object to 0,0,0? 2 Answers
How to Add Y Axis Offset to transform.localPosition on an Instantiated Prefab? 2 Answers
How to rotate object in instantiate with float value 1 Answer
Instantiating prefab of object like it was in the scene 0 Answers
Android based ARCore example ObjectManipulation using Joystick Controller 0 Answers