Jump to content


Photo

The Basics Of Controlling An Object :


  • Please log in to reply
16 replies to this topic

#1 Odb718

Odb718

    X-S Freak

  • Last Chance
  • PipPipPipPipPip
  • 1,589 posts
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 22 October 2005 - 08:48 PM

Here's a general tip on understanding the way the dash works.
Default.xip / Default.xap is used to mainly call up other things and controll the main menu.
In the Default.xip you'll see a bunch of other xaps with the names of the menus they controll. Those xaps controll the functionality of those menus, and if an object moves where it moves to.

Take the clock menu for instance. The xap that controls it is the settings.xap inside default.xip. If you scroll down a bit in the settings.xap you'll come across
CODE
DEF theSetClockMenu Level
{
name "theSetClockMenu"
   archive "Settings_Clock.xip"

the name theSetClockMenu is used to refer to the archive for various things; What text to update, what object to texture when, and where to move objects. Now the original placement of objects and the default text is defined in the archive. Which in this case is Settings_Clock.xip.

Inside the DEF theSetClockMenu Level you'll see an inline
CODE
       Inline
       {
           url "Settings_Clock/default.xap"
           function onLoad() { StartClockSettings(); }
       }


Most inlines are found in default/default. In this case, it's found inside the settings.xap. The url in the inline is telling the dash what file to use to find out all of the menus properties for placement and materials. As you can see it's telling it to use the default.xap inside the Settings_Clock.xip. It's important to have an inline tell the dash what xap to use because some xips contain more then just one xap, and if a xap is used to load up one menu it can't be used to load a second menu... (IE the memory manager and the hard drive menu) In this case a second default.xap would be needed and would be named anything ( usually default2.xap ) and the inline would call for the second xap.

Now if you wanted to edit the clock menu you'd know what xap was controlling all of the materials and placement. Also, the xap would also be using the xm files (meshes) from inside the xip the xap is loaded from. So to find what object you wanted to retexture, you could look inside the xip and see the list of meshes used for the menu. Some meshes, like the cellwall, aren't included in the xip to save space.
Check out each xm untill you find the mesh you want and search for it's name inside the inline's target. (Settings_Clock/default.xap) It should bring you to a DEF of the object. Some meshes are used more then once so search around to get a better sence of where the object you want is defined. Once you're at the right DEF it should look similar to

CODE
       DEF something Transform
       {
           children
           [
               Shape
               {
                   appearance Appearance
                   {
                       material MaxMaterial
                       {
                           name "somematerial"
                       }
                   }
                   geometry DEF something-object Mesh { url "something-object.xm" }
               }
           ]
           rotation
           scale
           scaleOrientation
           translation
       }


Now, You can edit the original properties of the object in question in the inline target (Settings_Clock/default.xap)or you can redefine it using the controll xap. (default/settings.xap)
If you wanted to use the controlling xap you'd refer to the object by
CODE
thename.children[0].children[0].theobject.children[0].the.attribute = "the update";
Which is
CODE
theSetClockMenu.children[0].children[0].something.children[0].appearance.material.name = "Typesdsafsda";

Or if you were to redefine a number of objects you can simplify the process by making the name into a variable.
CODE
var c = theSetClockMenu.children[0].children[0];
c.something.children[0].appearance.material.name = "Typesdsafsda";
c.something1.children[0].appearance.material.name = "HilightedType";

the c before the object is defined above the function so it knows what c represents. As you can see if you replace the c with what it is defined as it would be the same as the set up above. This set up is usefull because it lets you easily see what objects you're redefining. If you wanted to update more then one attribute of an object this set up is usefull too. You would set it up like
CODE
var c = theSetClockMenu.children[0].children[0];
c.something.fade = 0; // speed of transition of something, higher numbers = slower
c.something.SetTranslation( -8.773, 4.723, 71.96 ); //makes something move
c.something.SetScale( 1, 1, 1);//defines the size of something

as you can see the .children[0] is missing from c.something.children[0]. If you look above you can see that in the DEF the apperance, material, material name, and mesh are defined inside children [ ] and the rotation, translation, scaleOrientation and scale aren't. That's the reason .children[0] isn't needed in this case wink.gif

Using the controll xap to update the object is usefull for having the object update on button presses. If you want the object to first appear a certain way or position it's better to define it in the inline xap.

I hope this helps out with what ever mods you guys do to the UIX dash. If you got a question on something, go ahead and ask.
A list of scriptable functions is located in the UIX readme.
beerchug.gif

#2 midas

midas

    X-S Senior Member

  • Members
  • PipPip
  • 271 posts
  • Location:Galveston, TX
  • Interests:boom.
  • Xbox Version:v1.4

Posted 28 October 2005 - 04:42 AM

Yeah but you still didn't add anything about:

CODE
SetTranslation();


#3 Odb718

Odb718

    X-S Freak

  • Last Chance
  • PipPipPipPipPip
  • 1,589 posts
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 28 October 2005 - 06:10 AM

QUOTE(Odb718 @ Oct 22 2005, 09:59 PM)
c.something.SetTranslation( -8.773, 4.723, 71.96 ); //makes something move

I dont get your question. SetTranslation means where the object is. If you change the values ( x, y, z ) the object/group will move to that spot on the screen. If you want it to return to it's original spot in another function you'd need to copy the values out of the xap.

#4 midas

midas

    X-S Senior Member

  • Members
  • PipPip
  • 271 posts
  • Location:Galveston, TX
  • Interests:boom.
  • Xbox Version:v1.4

Posted 29 October 2005 - 03:56 AM

To what scale is the screen? Like is there an origen (0,0) and where does it go to (255,255)?

Sorry for the vague question. I don't knwo if you were planning on going this in depth with this thread . . . . but I would really appreciate it, especially with the new features of 2.0 and its .xip handling abilities. . . .

#5 Odb718

Odb718

    X-S Freak

  • Last Chance
  • PipPipPipPipPip
  • 1,589 posts
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 29 October 2005 - 06:11 AM

The screen depends on what veiwpoint is used. But since the veiwpoints are usually different you can't assume that the same translation will be in the same spot on the screen in a different menu. Getting the meshes on the screen where you want them is pretty tough.

There's no limit to the translation that I've noticed. ( notice the -8.773 )
In this case the object I was moving was on the right side of the skin, but because of the veiwpoint (the camera spot) -8 is the right side of the screen and about -10 was the left side of the screen. All I can tell you is the first value moves the object left and right, the middle value moves it up and down, and the third value moves the object in and out of the background. How that's set up is defined by the viewpoints. If the camera was looking down, then z would move the object up and down, x would still be left and right, and y would raise and lower the object.

Take the Soundtrack controll menu for instance. It has the small 5 tab menu and when you select your function the big panel flips down into view. If the viewpoint doesn't change you wouldn't be able to see the menu. You would still be able to access the functions but you wouldn't be able to tell what song you were on.

Getting the right spots for your mesh depends on how you want it to look. If you wanted the mesh to be parallel to the screen you might have to rotate it, if you wanted it to have a lot of perspective you might want it far in the background but scaled up. There's no one set answer to the translation. The object could look exactly the same but the scale and position could be totally different. You just have to mess with it untill you get what you're looking for... which could be a lot of testing.


#6 midas

midas

    X-S Senior Member

  • Members
  • PipPip
  • 271 posts
  • Location:Galveston, TX
  • Interests:boom.
  • Xbox Version:v1.4

Posted 29 October 2005 - 01:21 PM

Well, thats a lot fo help. Seriously. Is SetRotation() the same way as in (x,y,z,)? and SetScale()?

#7 Odb718

Odb718

    X-S Freak

  • Last Chance
  • PipPipPipPipPip
  • 1,589 posts
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 29 October 2005 - 06:44 PM

QUOTE(Odb718 @ Oct 22 2005, 09:59 PM)
c.something.SetScale( 1, 1, 1);//defines the size of something

rotation can have 4 variables in it. The readme should have examples of all the scriptables.

#8 midas

midas

    X-S Senior Member

  • Members
  • PipPip
  • 271 posts
  • Location:Galveston, TX
  • Interests:boom.
  • Xbox Version:v1.4

Posted 01 November 2005 - 09:25 AM

No example of SetRotation in the readme. From what I can gather its (X,Y,Z,Scale) but I am not sure on that one. . . .

#9 Odb718

Odb718

    X-S Freak

  • Last Chance
  • PipPipPipPipPip
  • 1,589 posts
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 12 December 2005 - 09:14 AM

Sorry about the late reply but it's actually X,Y,Z,R.
The last number is actually for the rotation point.

#10 midas

midas

    X-S Senior Member

  • Members
  • PipPip
  • 271 posts
  • Location:Galveston, TX
  • Interests:boom.
  • Xbox Version:v1.4

Posted 19 December 2005 - 05:20 AM

Rotation Point?

I thought it was X,Y,Z, Radians?

I think thats what acid said (it might have been him)

#11 gasclown

gasclown

    X-S Freak

  • Members
  • PipPipPipPipPip
  • 1,128 posts
  • Location:Brisvegas
  • Xbox Version:v1.4
  • 360 version:unknown

Posted 19 December 2005 - 11:45 PM

well from what ive always thought, ^^ its sorta the same. the last value is the angle of the object(s) in radians. ie. the first 3 values set up its position in the 3d space the fourth value sets up the "angle" its viewed from in this space.

#12 JbOnE

JbOnE

    X-S Expert

  • Head Moderators
  • PipPipPip
  • 526 posts
  • Gender:Male
  • Xbox Version:v1.4
  • 360 version:unknown

Posted 20 December 2005 - 11:37 PM

rotations are set using quaternions. the first 3 are the x, y, z values of the axis vector, the last is the angle in radians of the rotation on that axis. google up the theory behind 3d vectors to clear up any questions on that part wink.gif

Edited by JbOnE, 21 December 2005 - 12:06 AM.


#13 Odb718

Odb718

    X-S Freak

  • Last Chance
  • PipPipPipPipPip
  • 1,589 posts
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 21 December 2005 - 12:59 AM

Oh I think that quick little lesson in quatum physics just did wink.gif

#14 midas

midas

    X-S Senior Member

  • Members
  • PipPip
  • 271 posts
  • Location:Galveston, TX
  • Interests:boom.
  • Xbox Version:v1.4

Posted 22 December 2005 - 06:02 AM

QUOTE(JbOnE @ Dec 20 2005, 11:44 PM) View Post

rotations are set using quaternions. the first 3 are the x, y, z values of the axis vector, the last is the angle in radians of the rotation on that axis. google up the theory behind 3d vectors to clear up any questions on that part wink.gif


I was right! HAHA! Your's sounds more technical though.

#15 Odb718

Odb718

    X-S Freak

  • Last Chance
  • PipPipPipPipPip
  • 1,589 posts
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 25 December 2005 - 09:36 AM

uuuuuhhhh... I think you misread JbOnE's post.
QUOTE
the last is the angle in radians of the rotation on that axis.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users