PDA

View Full Version : LAYOUT: Change an item's parent while respecting pareint in place?



NanoGator
09-20-2004, 07:33 PM
Hi All,

First, lemme describe what I'm trying to automate:

- Load an object.
- Move that object to anywhere but 0,0,0
- Add a Null
- Move the Null to an interesting world co-ordinate that's not 0,0,0
- Make sure Parent in Place is on
- Parent the Null to the Object

If I do these steps manually in Layout, I get exactly the result I want. The Null is at the world co-ordinate I want, and when I parent it to the object, it maintains the same world-coordinate. It's local co-ordinates are automatically assigned to maintain that position.

However, when I do this in LScript, the ParentItem command appears to reset the local position of the Null to 0,0,0. Is there any way to change the parenting relationship of the Null while making sure that, in the end, it maintains the same world co-ordinate? Is there some alternative to "ParentItem()"?

Cheers

NanoGator
09-20-2004, 07:51 PM
I mighta solved it. I added "NextFrame();PreviousFrame();" after changing the position/rotation, that seems to be working now. I think my mistake was in assuming that LW was automatically resetting the object. Instead, I think it was being moved before 'autokey' was kicking in. So by forcing the frame to go back and forth, it registerred the changes. Oddly enough, though, using 'creatkey' didn't work.

If anybody can provide insight into this, I'd appreciate it.

NanoGator
09-20-2004, 08:09 PM
okay, it works. I replaced prev frame next frame with 'RefreshNow();' and now I have a working script.