0
$\begingroup$

I created a simple python script which takes the selected object and transforms it in some (partially random) way.

I would love to recreate this behavior with animation nodes but am stuck. Any help would be greatly appreciated.

import bpy
import random

random.seed(12)

for i in range(0,100):
    c = bpy.context.object
    bpy.ops.object.duplicate_move_linked(OBJECT_OT_duplicate={"linked":True, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(c.dimensions[0], 0, c.dimensions[1]),  "constraint_orientation":'LOCAL', "constraint_axis":(True,False,True)})
    bpy.ops.transform.rotate(value=random.random()/2-0.3, axis=(0, 0, 1), constraint_axis=(False, False, True), constraint_orientation='LOCAL')
    bpy.ops.transform.resize(value=(0.98, 0.98, 0.98), constraint_orientation='LOCAL' )

Pyhton script and result Best regards blackno666

$\endgroup$
1

2 Answers 2

0
$\begingroup$

This is one possible way to set this up in Animation Nodes:

setup

For convenience I control the fixed part of the transformation by using the transformation values of an Empty, similar to an Array Modifier with Object Offset.

The amplitudes for the random parts of the transformation are entered manually. The seed of each Wiggle node should be set to the loop index so that subsequent objects get different wiggle values.

result

$\endgroup$
1
$\begingroup$

binweg's answer solves the problem perfectly. The only problem that might occur is with adding Euler angles. Flipping might occur which will lead to improper results as shown in the following picture (where no cube but a pentagon was used as base shape):

improper result due to Euler angle math

The problem can be got rid of by using quaternions math instead of Euler math as shown in the following setup:

Animation node setup with quaternions

Unfortunately for the 'Object Transform Input' to work properly with Quaternions, the Transform for the Rotation of the corresponding object (in this case the Empty) must be set to Quaternion (WXYZ) in the properties panel of the 3D View.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .