Game Development Community

Basic 3D Tutorial Problems

by Tony Pitman · in Torque X 3D · 10/30/2009 (11:20 pm) · 3 replies

I, like others, am trying to follow the Basic 3D Tutorial. I just want to get a player control component into my game.

I followed the Basic 3D Tutorial. When my scene gets loaded I see the following output in the output window:

T3DCameraComponent._SetTransformInterface - Interface cam not found.
FSM.RegisterState - State type GarageGames.Torque.T3D.OnGroundControlState does not exist.
FSM.RegisterState - State type GarageGames.Torque.T3D.InAirControlState does not exist.
A first chance exception of type 'System.NullReferenceException' occurred in GarageGames.TorqueX.Framework3D.dll
An unhandled exception of type 'System.NullReferenceException' occurred in GarageGames.TorqueX.Framework3D.dll

Additional information: Object reference not set to an instance of an object.

The line that it breaks on is:

((ControlState)_currentState).UpdateControl(this, move, dt);

This is in the ProcessTick function of the T3DControlComponent class.

#1
10/31/2009 (2:07 am)
I'm not sure what the Basic 3D tutorial is, but the two States in question are a part of the T3DGroundComponent.

The T3D Control component is used to create specific states, that can either allow or disallow key commands based on whether you are in the air or ground, and allow you to specify what ground is considered. But to do this correctly they need to contain the states you wish to swap around to. You could also add other states, such as flying or swimming.

My guess is that they are being called, but were not initially set in the XML. A Getcomponent call will return null if the component does not exist.

The Code you would want to add would be:

<ControlComponent type="GarageGames.Torque.T3D.T3DGroundControlComponent" name="">
<XMLControlStates>
<ControlState>
<Name>OnGround</Name>
<Type>GarageGames.Torque.T3D.OnGroundControlState</Type>
</ControlState>
<ControlState>
<Name>InAir</Name>
<Type>GarageGames.Torque.T3D.InAirControlState</Type>
</ControlState>
</XMLControlStates>
<StartState>InAir</StartState>
</ControlComponent>

It may solve the second two issues.

Do not delete the existing information in the Control Component, but make sure the states are there and properly named/assigned.
#2
11/25/2009 (6:57 pm)
I'm getting the same problems.

This is the url for the tutorial:

tdn.garagegames.com/wiki/Torque_X/Basic3DTutorial

I sorted the first problem by adding a "cam" node to my character model, but still getting the problems with the states. This is the xml that the tutorial says to add:

<ControlComponent type="GarageGames.Torque.T3D.T3DGroundControlComponent">
          <SceneGroupName>PlayerMesh</SceneGroupName>
          <ControlStates>
            <ControlState>
              <Name>OnGround</Name>
              <Type>GarageGames.Torque.T3D.OnGroundControlState</Type>
            </ControlState>
            <ControlState>
              <Name>InAir</Name>
              <Type>GarageGames.Torque.T3D.InAirControlState</Type>
            </ControlState>
          </ControlStates>
          <StartState>InAir</StartState>
        </ControlComponent>

Anyone manage to get this tutorial to work?
#3
11/27/2009 (10:52 am)
Hi i have the same problem ( this occur when player get register), log detail from the TXB ( i got this when i try to add new component, but exception is same)

at GarageGames.Torque.T3D.InAirControlState.Enter(IFSMObject obj)
at GarageGames.Torque.Util.FSM.SetState(IFSMObject obj, FSMState state)
at GarageGames.Torque.Util.FSM.SetState(IFSMObject obj, String stateName)
at GarageGames.Torque.T3D.T3DControlComponent._PostRegister()
at GarageGames.Torque.T3D.T3DGroundControlComponent._PostRegister()
at GarageGames.Torque.Core.TorqueComponentContainer._PostRegisterComponents()
at GarageGames.Torque.Core.TorqueObject.OnRegister()
at GarageGames.Torque.Core.TorqueObjectDatabase.Register(TorqueObject obj)
at TorqueXBuilder3D.FormMain.btnAddComponent_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at DevComponents.DotNetBar.ButtonX.OnClick(EventArgs e)
at DevComponents.DotNetBar.ButtonX.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevComponents.DotNetBar.PopupItemControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


Any one can please point me whats wrong i am doing here. Is there is any other method/component is there which i can use to check if player is on ground ( apart from RayCast). Also if possible can anyone point out the beginner tutorial for TorqueX 3D.

Thanks.