Hi Morten,
i dont think its possible to solve this in ICE, becouse you cant change
the AnimationCurves....
(While tipping this i actually have a Idea....)
anyway....
I found a little snipped in the Web to get the Objects COG in Global
Space (https://gist.github.com/yamahigashi/9309426)
Now I just wrapped this in a little Loop, and created some PoseConstrains.
After executing the Script, you just have to
- Plot the Nulls Transforms
- Remove the RBDs Transforms
- Parent or Constrain or Envelope the RBD's to the Nulls
Hope this works.
Could'nt test this.... just some thoughts. ;-)
Vincent
Am 14.05.2014 16:22, schrieb Morten Bartholdy:
I need to find a way to fix fcurves and pivots on a large number of
objects (tumbling boulders) RBD simulated in Realflow (don't ask).
When they come in they move correctly, but their pivots are way off
from the geometry and fcurves suffer from gimbal flipping, so
motionblur obviously doesn't render properly.
I was thinking it would be relatively simple to get good motiondata by
piping them through ICE, calculate motionvectors for each vertex and
set the data again. I guess there is a way to move the pivot of each
object to its centre too, while maintaining the same motion.
It is however way beyond my ICE capabilities, so I am looking for
tutorials, pointers, scripts or possibly other tools that might do the
trick.
Thanks
Morten
xsi = Application
"From https://gist.github.com/yamahigashi/9309426"
def calc_cog_global_position(obj):
''' calculate objects cog position in global space. returns vector3 '''
#x, y, z, b1, b2, b3 =
Application.Selection(0).ActivePrimitive.Geometry.GetBoundingBox()
#v = XSIMath.CreateVector3(x, y, z)
if obj.ActivePrimitive.Geometry is not None:
x = obj.ActivePrimitive.Geometry.Points
v = XSIMath.CreateVector3()
for p in x:
v.Add( v, p.Position)
v.Scale(1.0 / x.Count, v)
res =
XSIMath.MapObjectPositionToWorldSpace(obj.Kinematics.Global.Transform, v)
return res
else:
t = obj.Kinematics.Global.Transform
return XSIMath.CreateVector3(t.PosX, t.PosY, t.PosZ)
xsi.SetUserPref("SI3D_CONSTRAINT_COMPENSATION_MODE", 1)
# Store Sel
sel = []
for obj in xsi.Selection:
sel.append(obj)
for obj in sel:
objCOG = calc_cog_global_position(obj)
print "Obj: " + obj.Name + " // COG: (" + str(objCOG.X) + "/" +
str(objCOG.Y) + "/" + str(objCOG.Z) + ")"
null = xsi.GetPrim("Null", "poseCons_" + obj.Name, "", "")
xsi.Translate(null, objCOG.X, objCOG.Y, objCOG.Z, "siAbsolute",
"siPivotCOG", "siObj", "siXYZ", "", "", "", "", "", "", "", "", "", 0, "")
xsi.ApplyCns("Pose", null, obj, True)
xsi.SetUserPref("SI3D_CONSTRAINT_COMPENSATION_MODE", 0)