Cannot find the Script File in Scripting a Scene Component sample

Jan 4, 2011 at 8:46 PM

Hi, 

 Scripting a Scene Component.doc and i keep getting this error at run time. 

http://tinypic.com/r/1zvbdcx/7

Where is it looking for the file and why can't it see it, I'm really confused. 

Editor
Jan 4, 2011 at 9:14 PM

any chance you can post your scene xml file?

Jan 4, 2011 at 11:05 PM

I was getting this error previously as well, I believe it had to do with how the Scene was named. What does your ScriptClass look like?

Jan 4, 2011 at 11:16 PM

<?xml version="1.0" encoding="utf-8"?> <SceneDocumentToken xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Components> <ComponentToken xsi:type="AmbientLightToken"> <ParentGuid xsi:nil="true" /> <Guid>21e99d9e-2d83-49da-9431-6bc743751e3a</Guid> <Name>AmbientLight:21e99d9e-2d83-49da-9431-6bc743751e3a</Name> <Position> <X>0</X> <Y>0</Y> <Z>0</Z> </Position> <Scale> <X>1</X> <Y>1</Y> <Z>1</Z> </Scale> <Orientation> <X>0</X> <Y>0</Y> <Z>0</Z> </Orientation> <OrientationPlayTime xsi:nil="true" /> <Box> <Center> <X>0</X> <Y>0</Y> <Z>0</Z> </Center> <Extent> <X>0.5</X> <Y>0.5</Y> <Z>0.5</Z> </Extent> </Box> <Color> <R>128</R> <G>128</G> <B>128</B> <A>255</A> <PackedValue>4286611584</PackedValue> </Color> </ComponentToken> <ComponentToken xsi:type="BasicModelToken"> <ParentGuid xsi:nil="true" /> <Guid>cd85b827-2590-4ec4-84ef-5a9e1184df34</Guid> <Name>BasicModel:cd85b827-2590-4ec4-84ef-5a9e1184df34</Name> <ScriptClass>Spinner</ScriptClass> <Position> <X>0</X> <Y>0</Y> <Z>-50</Z> </Position> <Scale> <X>10.625</X> <Y>10</Y> <Z>10</Z> </Scale> <Orientation> <X>0</X> <Y>0</Y> <Z>0</Z> </Orientation> <OrientationPlayTime xsi:nil="true" /> <Box> <Center> <X>0</X> <Y>0</Y> <Z>0</Z> </Center> <Extent> <X>0.5</X> <Y>0.5</Y> <Z>0.5</Z> </Extent> </Box> </ComponentToken> </Components> <Groups /> <CameraPosition> <X>0</X> <Y>0</Y> <Z>100</Z> </CameraPosition> <CameraOrientation> <X>0</X> <Y>0</Y> <Z>0</Z> </CameraOrientation> <PositionSnap>1</PositionSnap> <ScaleSnap>0.125</ScaleSnap> <OrientationSnap>15</OrientationSnap> <CreationDepth>100</CreationDepth> </SceneDocumentToken>

and the script


using Microsoft.Xna.Framework;
using Ox.Engine;
using Ox.Engine.Component;
using Ox.Engine.Utility;
using Ox.Scene;
using Ox.Scene.Component;


namespace OXSCriptTest
{
    /// <summary>
    /// Implements a script that controls a component.
    /// </summary>
    ///
    /*
    public class Scripting
        // TODO: If your script needs to talk with its component through a more specific type
        // than OxComponent, change ComponentsScript's generic type specifier.
        : ComponentScript<OxComponent>
     * */
    public class Spinner : ComponentScript<SceneComponent>
    {
        private float spin;

        public Spinner(OxEngine engine, Transfer<OxComponent> component)
            : base(engine, component)
        {
            // TODO: Put your script's initialization code here.
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // TODO: Put your script's disposal code here.
            }
            base.Dispose(disposing);
        }

        protected override void UpdateHook(GameTime gameTime)
        {
            base.UpdateHook(gameTime);
            // TODO: Put your script's update code here.
            spin += 0.05f; 
            Component.Orientation  = Matrix.CreateRotationX(spin); 

        }
    }
}


Jan 5, 2011 at 7:53 PM

In your Scene file, try changing your BasicModel ScriptClass to

OXSCriptTest.Spinner

Currently it just says Spinner.

OXSCriptTest stands for the namespace while Spinner stands for the public class defined in the namespace.