I’m trying to instantiate an object, and rotate it based off a float value.
This is what I tried:
public GameObject toInstantiate; //Drag in the object to instantiate here
float modifierF = 10.0f
public GameObject instantiatePoint; //Drag in the empty game object here
void Function () {
Instantiate(toInstantiate, instantiatePoint.transform.position, instantiatePoint.transform.rotation.x + modifierF, instantiatePoint.transform.rotation.y, instantiatePoint.transform.rotation.z);
}
I’ve even tried using a vector 3 in place of it. I tried Euler Angles. I want the instance to NOT be a child, spawn at the rotation of the reference point (instantiatePoint) and then change specific x, or y, or z angles based off a float value.
I’ve tried storing the created instance in a GameObject variable, however the object won’t be rotated how I want it to.
What happens is that it simply sets its rotation to (0,0,0) based on world axis, not the local rotation of the reference point.