- Home /
Keeping a gamobject in 3d space in front of the camera as if fixed on a display?
I want to calculate the position and orientation in 3d space to place a gameobject so that it appears in the same position and orientation in front of the camera as the camera moves around in 3d space.
I have only one slight problem, I have no idea how to calculate this (3d position and orientation). :-(
Does Unity provide any method to handle this? Is there a way to convert a screen coordinate from the camera display to a 3d point and direction in space?
Thanks for any help!
Answer by SarperS · Sep 13, 2015 at 06:17 AM
Camera.ViewportToWorldPoint is what you need.
http://docs.unity3d.com/ScriptReference/Camera.ViewportToWorldPoint.html
This looks perfect for what I need!
Thank you! Thank you!
And yea Unity!
Answer by Zanyblax · Sep 13, 2015 at 09:37 AM
Hi,
I'm not quite sure what you're asking for....
do you mean like a first person game with arms?
If so... try this tutorial
https://www.youtube.com/watch?v=0aMiztZB2YM
I find that SpeedTutor is a really good person to watch for tuorials.
Sorry if that isn't what you meant....
Your answer
Follow this Question
Related Questions
Correct way to spawn and move objects 1 Answer
How can I join 2 objects when objectB enter in objectA' s collider? 1 Answer
GameObject[0].SetActive (false); more than one GamObject possible? 2 Answers
Why is this C# script causing lag spikes between the game objects being cycled?, 1 Answer
sync color change of objects c# 1 Answer