Notifications
Clear all

[Closed] Fade With Camera Angle

Ok This is my first attempt at a script of any kind…(Apart from a wheel script but more of that later )

This is a simple script controller which sits in the visibillity controller of an object.
The idea came from a client job where the client asks for a logo to ‘look like this from a certain angle and look like this from another angle’. ( I don’t know they want it all !)

Rather than manually animate it from every angle the logo would be seen from, I thought I’d try to open up some maxscript knowledge. The idea being that I could extend this simple ‘script’ to control how an object looks and changes through the morph channels on an object pending camera position.

As a basis I used the ‘Billboard tutorial’ in Maxscript Ref.

It would be of great help if somebody who knew what they were doing could run their eye over the script and offer any advice on if I’ve approached this correctly – or in fact how they would solve this simple problem. As you can tell my Maths is not great… but any advice would be welcomed especially on how to adopt this so that the fade works in more that one
axis.

Cam=$Camera01
MyObj=$Box01
CamPos=Cam.pos
ObjPos=MyObj.pos
BoxRot=MyObj.rotation as eulerangles
MyBoxRot = BoxRot.z
d = CamPos – ObjPos
dz=d.z – store z value
len=length d –vector length
z_rot= acos(d.x/len)(d.y/(abs d.y))
Dif=(MyBoxRot-z_rot)-90
if Dif < 0 then Dif
= -1
Final = 1-(Dif/100)*1.2

Create a box in TOP viewport (called Box01 ) add a visibilty track and paste the script into its controller. Then make a Camera (called Camera01)
and move the camera or rotate the box 90 degrees in the top vp for it to fade in and out.
or see the attached file