- Home /
Question by
ToeBeanGames · Feb 12, 2015 at 07:01 AM ·
transform
get transform local axis
This isn't asking about transform.localPosition at all. Basically all I need to do is figure out if the camera's transform is greater than/less than the script's gameobject's position on its local axis.
I'm using C#.
Comment
Best Answer
Answer by hexagonius · Feb 12, 2015 at 07:13 AM
Depending on the axis you mean do this:
if (yourObject.transform.InverseTransformPoint(Camera.main.trasnform.position).x > 1){}
This gives you the camera in your GameObjectes local space. You can then check naturally if its behind (z < 0), above (y > 0), whatever
Your answer

Follow this Question
Related Questions
move enemy to random transform array 2 Answers
Moving an object towards a clicked object 1 Answer
Create an animation with variables? 1 Answer
C# move y position of object not working 2 Answers