Hi,
I have the below code in my program
This sets the object in the desired X & Z position, but not in the desired Y position.
Vector3 centre = p_hitDetails.point;
Vector3 displacement = new Vector3(0, minGrabSpaceHeight / 2, minGrabSpaceLength / 2);
centre = centre + displacement ;
GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube);
cube.transform.position = centre;
When I change it to below.
It moves the object to the desired Y position. But I will be unable to place it in the desired Z position.
Vector3 centre = p_hitDetails.point;
Vector3 displacement = new Vector3(0, minGrabSpaceHeight / 2, 0);
centre = centre + displacement ;
GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube);
cube.transform.position = centre;
What am I missing? Please advise.
Edit: The object is not a child of any object.
Thanks.