This website views at its very best in Firefox web browser, and is not available in a mobile version.

      Copyright © All Rights Reserved | Built by Serif Templates

Parchment Background Image for How To's: The Ultimate CTR Creator, Page 18, on FlightToAtlantis.net Please turn to Page 19

Restraint XML's






This topic is written on the assumption you've previously gained knowledge of writing XML's, or have already read our previous session Making Progress With Your XML's. If you need information that is more basic than that which we've provided in this session we suggest you first review that article.






Just like we did when we animated car doors, Kiotho's blank XML templates, included with CTR Creators' Pack, will help us get started. The templates will come named:







Opening,


OpenIdle,


Closing, and


ClosedIdle.






Copy and paste these templates into the WagenDaten_ work folder of the car you are animating.






Although it requires a Parent bone and a Child bone our restraint is a basic one with a single rotation. The angle of this rotation is a personal choice and is dependent on the profile of the restraint, whether or not our seats lean back, and the effect we wish to achieve. Most restraints will be set up to rotate 90° or more into the opened position. As we indicated right after the previous video, Testing Your Restraint's Rotation, what we want is for the restraint to open by rotating 106.5° upwards and then for it to return to its closed position.






We can only enter angles into XML's by converting them into radians so after we've settled upon the desired angle of rotation we need to convert our angle value into a radian value. In our previous session, What's in an XML?, we recommended a Google search for finding a converter. With such a converter 106.5° will convert to 1.85877565337396 radians. We'll chop this back to eight decimal places and enter a value of 1.85877565 for this rotation in our XML.






Again we'll refer to our illustration showing the various plus and minus rotation directions. In SketchUp our car is facing towards the park entrance along the X axis and as you see in the image we'll need a restraint rotation around the Y axis.






Image 178, HowTo's: The Ultimate CTR Creator, Page18

If we imagine the restraint opening in the desired direction the illustration shows us this will be a positive radian value and not a negative value.






Let's prepare our XML's by making some alterations. This is the information that comes in our Opening XML template.






Image 179, HowTo's: The Ultimate CTR Creator, Page18

We're working with two bones so we need two bone entries. With a simple copy and paste, this is how each of our XML's should look after they've been prepared (again exampled with the Opening XML).






Image 180, HowTo's: The Ultimate CTR Creator, Page18

Next, delete line 9, 10, & 11 from each XML after which our XML's should look like this.






Image 181, HowTo's: The Ultimate CTR Creator, Page18

We're done for now with bone_RestraintOnePPivotPeep01. This is because our pivot mesh does not rotate or translate and only serves as a base for the Parent bone so it only needs this brief acknowledgement in the animation. The other reason is because every Opening animation should start with an anchor entry containing all 0 values and depending on the other transitions in your animation, this should either be a rotation or a translation.






Now we'll work on one XML at a time and focus on the rotating part of our restraint arrangement, bone_RestraintTwoCRestraintPeep01.






  Opening






We've started with our anchor entry representing all 0's in line 13. We also want our restraint to open 1.85877565 radians around Y and we want it to take 4 seconds to do that so we'll put that information in line 14.






Your Opening XML should look like this.






Image 182, HowTo's: The Ultimate CTR Creator, Page18

Save your Opening XML.






  OpenIdle






We can consider this animation as the Open position being held in place, therefore for this animation we need only a single line of code. To get that code we'll simply copy and past line 14 of the Opening XML as line 13 into OpenIdle. In that line change the rotate time to 0 seconds which will give us an XML that looks like this.






Image 183, HowTo's: The Ultimate CTR Creator, Page18

And there's our OpenIdle XML done. Save your work.






  Closing






There will be two lines of code in this XML. The first line needs to reflect where our mesh was located while it's been on hold in OpenIdle so we'll copy line 13 from OpenIdle and paste it as line 13 into Closing.






Next we want our restraint to close in the same amount of time it took for it to open so here in Closing copy line 9, paste it in as line 14, and then change the rotate time to 4 seconds. Here, the X, Y, and Z values need to be 0's because the restraint will be returning to it's original closed position.






Image 184, HowTo's: The Ultimate CTR Creator, Page18

You may save Closing now that it's completed.






  ClosedIdle






All we need in this XML are two anchor entries each made up of all zeros to indicate to the game engine our meshes are back in their anchor positions.






Image 185, HowTo's: The Ultimate CTR Creator, Page18

Save your ClosedIdle XML.












Organization and clarity are paramount when writing animation XML's because they're much easier to understand and to edit when their contents are neat and tidy. Better organisation will also help when it's time to duplicate your carefully crafted animations for each of your restraint sets because you can simply copy, paste, and then alter the data in each to represent a different seat in your car and we'll show you this time-saving step next.






Our car has four seats. Now that we've set up the animation for a single restraint (Peep01/Seat 01) it will be a simple matter to set up the remaining three. Let's return to Opening.






Image 186, HowTo's: The Ultimate CTR Creator, Page18

Copy lines 8 to 15. Paste these eight lines so when you're done they appear a total of four times in this XML, one time for each of the Peeps/Seats.






To keep yourself organized add a divider line between each of the four copies. So that they're not included in your animation make sure you add your divider lines inside the personal notes header (<!-- ) and the personal notes footer ( -->).






Image 187, HowTo's: The Ultimate CTR Creator, Page18

So that they correspond to the fact that there are four seats in your car, alter the Peep bone number in each of the groups that you just made. You'll now have one group for each of the four Peeps/Seats in the car.






Image 188, HowTo's: The Ultimate CTR Creator, Page18

And there we have it, our Opening XML now represents all four restraints in our car. Finally, do this same copy, paste, divider lines, and alterations to OpenIdle, Closing, and ClosedIdle.






If your car has in it, say, thirty seats, you'd probably want to copy & paste two or three restraints in each XML and test your results in the game before committing yourself to doing all thirty of them. If you're only testing a few of your Seats then the same restraints representing the same Peep number need to be represented in each XML, i.e., if out of your thirty seats you've decided to test Peep14, Peep15, and Peep16 then these same Peep numbers need to be indicated in all four of the test XML's.







Drag the above toggle to a

convenient place on your screen.




The Ultimate CTR Creator

Table Of Contents: