Hi,
I'm building a scatter tool for maya that uses nparticles and an instancer to distribute geometry in the scene.
I built my own sampler that basically returns a point array which gets fed into the particle system.
Alongside the point array i also get a normal array which I can use to calculate rotation values that match to the surface normal direction.
I achieve this my doing the following:
normal = n[i] # MVector, surfacenormal
world = OpenMaya.MVector(0, 1, 0)
rot_quat = OpenMaya.MQuaternion(world, n[i], normal_weight)
rotation = OpenMaya.MVector(math.degrees(rot_quat.asEulerRotation().x), math.degrees(rot_quat.asEulerRotation().y), math.degrees(rot_quat.asEulerRotation().z))
self.rotation_pp.append(rotation)
What I want to do now is to randomly rotate each instance by a certain amount of degree around its "local" x, y and z axis.
Can somebody point me towards the right direction how I can get the desired result?
thanks a lot,
Anno