- Home /
How place object in forward direction of the camera, even if camera is pointing to the ground or the sky?
I want to place one object in front of the camera, always at the same distance...
So if I am looking the ground, the object will be also at the same distance that if I am looking forward.
At this moment I am able to place the object at 2 meters when I am looking straight but If i am pointing to the ground with the camera , the object is placed closer than 2 meters.
Thank you
EDIT: Okey , I already did it.
object.transfrom.position = camera.transform.position; object.transform.rotation = Quaternion.Euler(0,camera.transform.eulerAngles.y,0); object.transform.Translate(Vector3.forward * 2 , Space.Self);
and thats it :D
Answer by YasinJavaid_ · Sep 07, 2017 at 01:15 PM
add projector component to some gameobject and make child of camera make it orthographic and u can also mange it with 2 cameras by handling layers. assign layer to object and 2nd camera assign only that layer you achieve what you want. ask anything you need further. thanks
I have no clue what this means, but it looks correct so it will work better than $$anonymous$$e.
two methods for this. 1) using projector component apply desire material set to orthographic make child to camera.
2) using one extra camera that one see the object that appears on screen in specific location. set desire layer to game object like "$$anonymous$$e" create new camera clear flags set to depth only set depth with according to other cameras in culling mask set "$$anonymous$$e" layer only. and in game view set your object in desire location.
Answer by connorwforman · Sep 07, 2017 at 12:55 PM
Drag and drop the object under the camera, and when your player with the camera moves, so should the object. If you haven't attached it already, drag the camera under the player.
$$anonymous$$mmmm. I think you didnt understand the question. I need to place one object in front of the camera at the same distance, no matters if the camera is pointing down or up.
Not attach it to the camera, because if I do that when i move the object will be always at the same distance.