Solve angle between camera and plane normal.

Hallo! I need help in writing script. So the idea is in testing angle between normal of a plane and FreeCamera viewing direction. I need to turn visibility of a plane off if angle is bellow 45 and above 135. I think the algorithm is something like that: angle between plane.1 normal and camera viewing direction >45 and <135, if true plane.1 visibility=1, if false plane.1 visibility=0.

but i really don`t know how to write it in MaxScript :(

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

a very useful, thanks!

a very useful, thanks!

my recent MAXScripts RSS (archive here)

Graph's picture

i guess you want to use it

i guess you want to use it for rendering/hiding sprites

get the camera direction and the object direction ( $.dir should work for planes and cams)
the angle between them you get like that afair :P

 diffAngle = acos (dot (CamDir) objDir)

Raphael Steves

infarq's picture

hi can i get a copy of the

hi

can i get a copy of the final script?

i need an script that depending on the angle between pivot point and a camera angle decide the visibility 100% or 0%

if the angle is in the range -22.5deg and *22.5deg visibility is 100%, out of this range, visibility will be 0

this must work for animated cameras and visibility could be stored as keys or in real time properties wired to the camera angle

the point is that it must work inside an xref scene

could you help me?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.