XNA Creators Club Online
Page 1 of 1 (9 items)
Sort Posts: Previous Next

Windows but not Xbox

Last post 8/13/2009 9:43 PM by Manuel Moos. 8 replies.
  • 8/13/2009 6:55 PM

    Windows but not Xbox

    Why does this code work fine on Windows, but give a compile time error on the Xbox copy?

    public void GetVelocity(ref Vector3 relPos, out Vector3 result) 
            {             
                result.X = transformRate.Velocity.X + transformRate.AngularVelocity.Y * relPos.Z - transformRate.AngularVelocity.Z * relPos.Y; 
                result.Y = transformRate.Velocity.Y + transformRate.AngularVelocity.Z * relPos.X - transformRate.AngularVelocity.X * relPos.Z; 
                result.Z = transformRate.Velocity.Z + transformRate.AngularVelocity.X * relPos.Y - transformRate.AngularVelocity.Y * relPos.X; 
            } 

    This is from the JigLibX library
  • 8/13/2009 7:02 PM In reply to

    Re: Windows but not Xbox

    What is the error?

    I've run JigLibX on the Xbox before and it's compiled fine. Are you sure you haven't changed something?
    "Software is never finished, it is in varying states of 'less broken'" because "If it ain't broke, it doesn't have enough features yet"

    In Playtest: Avatar Land | The MANLY Game for MANLY Men

    The signature that was too big for the 512 char limit
  • 8/13/2009 7:04 PM In reply to

    Re: Windows but not Xbox

    Dunno. Post your definition of transformRate, how it's accessed from that function, and of course, posting the actual error message, I'm sure that will help.
  • 8/13/2009 7:04 PM In reply to

    Re: Windows but not Xbox

    What's the error it gives you?
    Jim Perry - Microsoft XNA MVP
    If people spent a minute searching the forums and reading the FAQs before posting I'd be out of a job.
      Got some XNA Game Studio/XNA Framework development info to share with the community? Put it on the XNA Wiki.
        Please mark posts as Answers or Good Feedback when appropriate.
  • 8/13/2009 7:15 PM In reply to

    Re: Windows but not Xbox

    Sorry, should have posted that. Its:

    The out parameter 'result' must be assigned to before control leaves the current method C:\Users\...\Documents\Visual Studio 2008\Projects\JigLibX\0.3.1\JigLibX\Physics\Body.cs 726 21 Xbox 360 Copy of JigLibX

  • 8/13/2009 7:41 PM In reply to

    Re: Windows but not Xbox

    I may be remembering wrong, but isn't Vector3 a class on the XBOX? If so, then you need to assign a new Vector3 instance to "result".
  • 8/13/2009 9:24 PM In reply to

    Re: Windows but not Xbox

    I'm pretty sure Vector3 a struct for both, a class would give a sligtly different error right when you assign X.

    Regardless, I can reproduce the problem now with XNA 3.1, possibly it's some changed behavior. What you have to do to fix it is add
      

        result = new Vector3();


    at the top of the function. It just seems that the compiler is not smart enough to realize you're indeed assigning all three components. I suspect the standard requires the initialization with new Vector3() anyway, but I'm not a language lawyer.
  • 8/13/2009 9:30 PM In reply to

    Re: Windows but not Xbox

    See this thread for a full explanation. The issue relates to the tool used to generate the stub assemblies for the Xbox/Zune and how they handle struct initialization.

    The easiest way around the issue is to always call the default constructor for structs.
  • 8/13/2009 9:43 PM In reply to

    Re: Windows but not Xbox

    Ah. Useful information, thanks.
Page 1 of 1 (9 items) Previous Next