rotation pivot problem

Hello
I did a few lines of script for randomizing parked cars

"(
OBS = getCurrentSelection()
for OB in OBS do
(
a = #(0.0 , 180)
b = ( random 1 2)
--print OB as string
OBGZ = OB.rotation.z
NOBGZ = OBGZ + a[b]
OB.rotation.z = NOBGZ
)
)"

But the cars don't rotate around each car's pivot.
(I turned on "use pivot center" and "world")
Can somebody help ? Thanks :-)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Garp's picture

lol

You guys need to work more on your laziness.
Believe me, after a while you find ways to save a lot of keystrokes.

Garp's picture

Or even...

for obj in selection do rotate obj (180 * random 0 1) z_axis
Less typing ;)

br0t's picture

Garp, did u ever play UT?

Garp, did u ever play UT? *huuumiliatiooon* :D I got owned!
Very elegant one-liner

Never get low & slow & out of ideas

titane357's picture

yes... just one line !

yes... just one line ! brillant !
In fact I wanted to use an array :-)

br0t's picture

Hi, I am sure there is some

Hi,
I am sure there is some other way to fix this, but I still dont really understand those quaternion rotations ^^, so maybe this will work for you as well:

(
	OBS = getCurrentSelection()
	for OB in OBS do
	(
		a = #(0.0 , 180)
		b = ( random 1 2)
		rotate OB (eulerAngles 0 0 a[b])
	)
)

Cheers

Never get low & slow & out of ideas

titane357's picture

Thanks brOt, that's what I'm

Thanks brOt, that's what I'm looking for :-)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.