ScriptSpot

Forum topic · General Scripting

help with script to hide objects based on rotation

By ismail3d · 2010-12-22

Description

hi there

I don't have much knowledge in scripting, but in my current project i needed
a script that set the object visibility key to 0 when it's rotation more than 86 - I have more than 1043 object by the way :) - anyway ....

I did my 1st ever script - which i think is a crap :) - and one of my friends helped me a little and I reached this stage :

for i in selection do
(slidertime=slidertime+1
r = i.rotation as eulerAngles
if r.x >= 71 then
(
animButtonState = true
slidertime=slidertime-1
i.visibility = true
slidertime=slidertime+1
i.visibility = false
animButtonState = false
)
)

but it didn't work will for me, and I couldn't figure what's wrong .

Comments (2)

this should do

Graph · 2010-12-22


(
	local r = animationRange
	local sel = selection as array
	
	for t = r.start.frame to r.end.frame do for o in sel do with animate true at time t o.visibility = (o.transform.rotationpart as eulerangles).x >= 86
)

btw please use the

[code]

[/code] brackets

ismail3d · 2010-12-22

WOW

all in one line :)

thank you soooooooooooooooooooooooooooooo much .