TransWikia.com

Scripted expressions editor gives unexpected results

Blender Asked by Đorđe Manojlović on December 26, 2021

Does anyone know why when I type in driver editor / scripted expression I get funny values?
This is my examle:

I drive spotlight angle with an cubes translate Z value witch is limited to value between 5 and 8(limit location constraint).

So when I leave "var" alone (which is 5 value) the result is 180° instead of 5?

Does anyone knwo why and how to remap the range from 5-8 to be 1-180?

Thanks in advance!

One Answer

I answered my self when I posted this question :D

The scripted expression is working in radians by default and is auto converted to degrees in the spotlight object. So what I did was: var - 5 and got my range just in the sweetspot. Now it goes approximately from 1 to 172 deg.

I'm not sure for the precise math behind it, but it is working for me. If you need in depth how the math is functioning, check degrees to radians conversion.

Cheers!

Answered by Đorđe Manojlović on December 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP