View Full Version : Scaling plane by camera distance

03 March 2006, 10:02 AM
I'm trying to write a script what would scale plane on x axis (in local coordinate system) while moving camera closer and away from the plane.

Why I need it is that I have lines maped to the planes to fake hand drawn lines on 3D objects. But if camera goes too far then lines disapear. That's why I would like to have lines what would go thicker while moving camera away from them.

03 March 2006, 11:54 AM
From what u have mentioned here, you will need to assign an expression controller on the plane's scale property. Do this,

Go to graph editors >> track view-curve editor and select the plane object.
Select its scale property right click and select assign controller.
From the popup menu select scale expression
Now in the expression editor create the following variables

multiplier (scalar) - assign to constant - check with constants near 0.01
camPos (vector) - assign to camera's position controller
planePos (vector) - assign to plane's position controller

Now type this in the expression edit field
[(length(camPos) - length(planePos))*multiplier , 1, 1 ]

Hope this does what u want.

04 April 2006, 07:04 PM
Thanx, it worked just fine!!

06 June 2006, 02:53 PM
It might seam a stupid question, but how to make the same thing on cilinder radius. So that cilinder would remain with a constant thickness no matter how far camera is?

CGTalk Moderation
06 June 2006, 02:53 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.