Translating Objects "in formation"

Post » Thu Jun 21, 2012 10:53 pm

I did some experiments trying to translate a bunch of objects at the same time, hoping to have them move without "loosing formation" aka not flying around everywhere.
So what I did was placing a marker for each of the objects. I adjusted the position and rotation of this marker to be exactly the same as it's object counterpart, and then repeated for the other objects.
I then moved the markers (in formation, all selected at once) straight along the x-axis a little bit further down the room.

When I entered the TriggerBox that triggered the whole event though, the objects seemed randomly rotated and I got the impression that some of them was falling behind somehow (being further back during the translation than they should, in comparision to the other objects. When the translation finished though, some of the objects aligned themselves properly again, while a few were rotated in the wrong manner.

This is the translation script I used for each ref and its marker: MovingRef01.TranslateToRef(MovingRefMarker01, 1000)
I then used a utility.wait thing, and stopped the translation a few seconds later.


Is this a common issue? Have I missed something? Error in scripting, assigning marker to wrong object, etc?
User avatar
Jeffrey Lawson
 
Posts: 3485
Joined: Tue Oct 16, 2007 5:36 pm

Post » Thu Jun 21, 2012 2:14 pm

http://www.creationkit.com/TranslateToRef_-_ObjectReference will orient the translated object to the same orientation as the target object. That could explain why they seem to be rotated randomly.

As for why some of them are falling behind, that depends on how your script looks like. If your script is like this:

Event OnTriggerEnter(ObjectReference akTriggerRef)    MovingRef01.TranslateToRef(MovingRefMarker01, 1000)    MovingRef02.TranslateToRef(MovingRefMarker02, 1000)    MovingRef03.TranslateToRef(MovingRefMarker03, 1000)    MovingRef04.TranslateToRef(MovingRefMarker04, 1000)    ;etc.EndEvent

The reason is because it takes time to do the calculations for the translation before the objects start moving. So if it takes a tenth of a second each time, then your second object would be 100 units behind, the third one is 200 units behind, the fourth one is 300 units behind, etc.
User avatar
Solina971
 
Posts: 3421
Joined: Thu Mar 29, 2007 6:40 am

Post » Thu Jun 21, 2012 3:27 pm

http://www.creationkit.com/TranslateToRef_-_ObjectReference will orient the translated object to the same orientation as the target object. That could explain why they seem to be rotated randomly.

As for why some of them are falling behind, that depends on how your script looks like. If your script is like this:

Event OnTriggerEnter(ObjectReference akTriggerRef)	MovingRef01.TranslateToRef(MovingRefMarker01, 1000)	MovingRef02.TranslateToRef(MovingRefMarker02, 1000)	MovingRef03.TranslateToRef(MovingRefMarker03, 1000)	MovingRef04.TranslateToRef(MovingRefMarker04, 1000)	;etc.EndEvent

The reason is because it takes time to do the calculations for the translation before the objects start moving. So if it takes a tenth of a second each time, then your second object would be 100 units behind, the third one is 200 units behind, the fourth one is 300 units behind, etc.
about the rotation. The orientation of the destination markers are identical to their object counterparts. They're just moved along the x-axis. I don't understand why the objects would rotate around randomly :tongue:

Yes, I did use that. So is what I'm looking to do impossible? If not, what sort of work-around should I use?
User avatar
matt white
 
Posts: 3444
Joined: Fri Jul 27, 2007 2:43 pm

Post » Thu Jun 21, 2012 10:48 pm

Another reason why you might be seeing rotation is because the objects have havok. A translated object is still subject to physics unless you call http://www.creationkit.com/SetMotionType_-_ObjectReference on it.

I just guessed at a tenth of a second; I don't actually know how long it takes for the calculations to be done.

If that really is the problem, then you need to find a way so that the calculations for translating the objects are all done at the same time, instead of one after the other.

The only way I can think of is to have a script on each of the objects.
User avatar
bimsy
 
Posts: 3541
Joined: Wed Oct 11, 2006 3:04 pm

Post » Thu Jun 21, 2012 6:34 pm

Another reason why you might be seeing rotation is because the objects have havok. A translated object is still subject to physics unless you call http://www.creationkit.com/SetMotionType_-_ObjectReference on it.

I just guessed at a tenth of a second; I don't actually know how long it takes for the calculations to be done.

If that really is the problem, then you need to find a way so that the calculations for translating the objects are all done at the same time, instead of one after the other.

The only way I can think of is to have a script on each of the objects.
Nope, they are not havok objects!

Hmm, okay I'll have to think about applying scripts to each object and see if that works.
User avatar
Sarah Bishop
 
Posts: 3387
Joined: Wed Oct 04, 2006 9:59 pm

Post » Thu Jun 21, 2012 10:32 am

do they have to be in pieces? it might actually be worth it to construct a new nif with everything as one model.
User avatar
Rex Help
 
Posts: 3380
Joined: Mon Jun 18, 2007 6:52 pm

Post » Thu Jun 21, 2012 12:52 pm

do they have to be in pieces? it might actually be worth it to construct a new nif with everything as one model.
Also a good suggestion!!! How does one do that? If I recall correctly NifSkope doesn't work as well with Skyrim as it did with Oblivion?
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Thu Jun 21, 2012 6:25 pm

it's a bit of a PIA, but it is possible. the major downside is that you wont be able to import collision, so hopefully the assembled object doesnt need an exact collision model (but then again translate negates collision while it is motion anyway).

you can start by opening the base object in nifskope. lets say for example you are making an airplane. whatever the fuselage pice you are using, start with that, or whatever the player needs to stand on/in (basically the object that needs the functional collision).

you can then crtl+c the various NiTriShapes from other nif files into your main file, and reassemble the link tree by adding the index number of that child to the Properties section of the parent. you may also have to define the number of children it should have for every new piece you add in. eventually you want to have the main parent (which would be something like a BSFadeNode) contain all the children (NiTriShapes) in parallel, not generational... meaning all children are siblings, not parents to other NiTriShapes (unless that parent relationship existed in the original nif for that piece). it will start to get really tricky if you are importing stuff that has FX and such.

if at any point nifskope wont let you import a nitrishape because of a "failed to parent balh blah whtever), you will have to sever the parent/child relationship on the original nif file before copying it into the new nif file.
User avatar
Invasion's
 
Posts: 3546
Joined: Fri Aug 18, 2006 6:09 pm

Post » Thu Jun 21, 2012 5:43 pm

i also forgot to mention, you would have to offset each new piece's x/y/z coordinates to match your assembled "airplane". or an even easier way to do this would be to replicate the assembled vehicle in 3dsmax and export each piece as an obj, then import them into nifskope in place of their corresponding nitrishapes

if you want i can take a shot at rebuilding the nif for you as long as its not like 100 pieces (mainly to satisfy my own curiousity - i have successfully frankensteined small nifs together, but nothing really complex). place your assembled object in an esp in a blank cell with the main piece centered at 0,0,0 with all sattelite pieces aligned to that piece. then host the esp and send it to me.
User avatar
Ricky Rayner
 
Posts: 3339
Joined: Fri Jul 13, 2007 2:13 am

Post » Thu Jun 21, 2012 10:27 am

i also forgot to mention, you would have to offset each new piece's x/y/z coordinates to match your assembled "airplane". or an even easier way to do this would be to replicate the assembled vehicle in 3dsmax and export each piece as an obj, then import them into nifskope in place of their corresponding nitrishapes

if you want i can take a shot at rebuilding the nif for you as long as its not like 100 pieces (mainly to satisfy my own curiousity - i have successfully frankensteined small nifs together, but nothing really complex). place your assembled object in an esp in a blank cell with the main piece centered at 0,0,0 with all sattelite pieces aligned to that piece. then host the esp and send it to me.
That would be really awesome and helpful of you!!! :D I have to attend a graduation party right now, so I'll put it together when I get home!
It's a maximum of 14-18 pieces. But 14 is enough (I can explain this better when I send you the link, so it makes sense!! :P)
User avatar
Terry
 
Posts: 3368
Joined: Mon Jul 09, 2007 1:21 am

Post » Thu Jun 21, 2012 3:56 pm

btw, if anyone else was curious, it worked:

http://i47.tinypic.com/2whmayw.jpg


~20 nifs combined into a single translatable nif
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Thu Jun 21, 2012 10:07 pm

That's pretty epic.
User avatar
Vicki Gunn
 
Posts: 3397
Joined: Thu Nov 23, 2006 9:59 am

Post » Thu Jun 21, 2012 7:52 pm

Off-topic, but anyone know if there's a way to actually create collision yet? So far I've only found http://www.creationkit.com/Exporting_meshes_to_Creation_Kit which is not useful for me since I don't want convex collision, and http://niftools.sourceforge.net/forum/viewtopic.php?f=10&t=3562 which requires 3DSMax (which I don't have).
User avatar
Fam Mughal
 
Posts: 3468
Joined: Sat May 26, 2007 3:18 am


Return to V - Skyrim