Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"Float Expression" to control a light

4 REPLIES 4
Reply
Message 1 of 5
Roger.Bastow
295 Views, 4 Replies

"Float Expression" to control a light

Hi, this forum is brilliant 🙂

 

I now have a “Dummy” object and I want to rotate on “X” axis.

As it rotates, I want it to turn a light on and off at predefined angels.

I put a Float Script on X axis of my “Dummy” object and wrote this:

 

dummyRotation = $.rotation.x

if dummyRotation >= 10.0 and dummyRotation < 12.0 then

(

Spark001.Multiplier = 1.0 -- Turn on Spark001

)

else

(

Spark001.Multiplier = 0.0 -- Turn off Spark001

)

 

But when I Evaluate, I get –Unknown property: “multiplier” in undefined? Do I need a Variable?

Regards

Rog 😊

4 REPLIES 4
Message 2 of 5
leeminardi
in reply to: Roger.Bastow

I'm not familiar with spark lights but this is something that you should easily be able to do with a Wire Parameter.

 

For example,  when  the teapot angle in the following is >= 10° and < 12° the intensity is 1500, if not it's 0.

leeminardi_0-1700406814174.png

 

 

lee.minardi
Message 3 of 5
istan
in reply to: Roger.Bastow

I think, the error message is clear: "Unknown property: “multiplier” in undefined"

You have to find answers for these questions:

Is "Spark001" a variable you already defined somewhere else or is it undefined?

Is "Multiplier " a property of the object ?

 

Message 4 of 5
Roger.Bastow
in reply to: leeminardi

Message 5 of 5
leeminardi
in reply to: Roger.Bastow

@Roger.Bastow I should have noted that if it is possible that the object will rotate more than one full revolution then the modulo function "mod" should be used to always get an angle between 0 and 360.  Although the Transform Type-in may show an angle less than 360 it could be the remainder of the angle dividied by 360.

 

The wire expresson should be something like:

if(((mod (radToDeg(X_Rotation)) 360) >= 10) and ((mod (radToDeg(X_rotation)) 360) < 12)) then 1500 else 0

 

lee.minardi

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report