Notifications
Clear all

[Closed] Animated object hooked up to a dummy, how to find transform

Hey, so I have an annoying issue here.

I have a scene attached below, but you can also just make your own, its super simple.

I have one object (Sphere) whose position is animated. It’s also parented to a dummy, and the dummy has moved.

Now I want to move the Torus such that it’s animated in the same way the sphere is, and in the same position.

So if I do

$Torus001.transform.controller = $Sphere001.transform.controller

I get the animation, but the Torus isn’t in the same spot the sphere is. I understand why its not working, but does anyone have a good idea on how to get both the animation and also have the Torus be in the same spot as the sphere?

  • Neil
9 Replies

that because torus and sphere are in different coordinate system. one in the world, the another in the parent.
if you want to constraint torus to sphere just use position and orientation constraint controllers. also you can do it with scripted transform applied to torus.
if it could work for you i can show a sample

edit…
in you case it’s


c = $Torus001.transform.controller = transform_script()
c.addnode "target" $Sphere001
c.setexpression "target.transform"

Afraid that won’t work, as the goal is to have the original animated transform on the sphere applied to the torus, such that the torus now have the animation keys, and if you deleted the sphere from the scene the torus would still do the correct thing.

But thanks for the suggestion.

  • Neil
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0
it sounds like you want to have some kind of an instance of the sphere transform controller applied to the torus, right?

you can’t do it if the sphere and the torus are in different coordinate systems. position, rotation, and scale controllers are relative controllers…

that’s the best what i could contrive:


 delete objects
 s = point name:"s" pos:[20,0,0] box:on size:5 wirecolor:orange 
 t = point name:"t" pos:[0,0,0] box:on size:10 wirecolor:green
 p = point name:"p" pos:[-20,0,0] box:on size:10 wirecolor:blue
 t.parent = p
 c = s.controller = Link_constraint()
 c.addtarget p 0
 c[1].controller = t.controller
 

Thanks again for the work, but changing controller types like this won’t work for the actual script I need to write. It’s ok, I’ll just bring the info to my client, it seems like there’s no elegant way to make this work.

Thanks for the tips!

  • Neil

Silly me, I think I just figured out a workaround. Have the script unparent my Sphere, then copy the controller, then reparent the Sphere to the point. Wouldn’t that do the right thing? Seems to from my tests.

  • Neil
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

if you link torus to point it would.

Well technically, I wouldn’t even have to link the torus to the point, assuming of course I don’t ever move the point again. But yes, if I wanted to move the point later and have the torus come along for the ride, then I’d parent it there.

Guess there’s always more than 1 way to skin a cat

  • Neil

if you took your scene as a literal example, where the point parent has only transformation applied as an offset, you could also add a list controller to the torus, add the point positionXYZ as the first controller, and the sphere position controller as controller 2. You are then creating the offset transform in the controller hierarchy.

pPos = $point001.position.controller
sphPos = $Sphere001.position.controller

$torus001.transform = $point001.transform
$torus001.position.controller = position_list()
$torus001.position.controller[1].controller = pPos
-- need to add a controller before we can set it active 
$torus001.position.controller[2].controller = Position_XYZ()
$torus001.position.controller.active = 2
$torus001.position.controller[2].controller = sphPos

It would update the first offset position if you moved the point in the future too, however it falls down if there’s any rotation on the parent. But I suspect that isn’t terribly robust!