Game Development Community

Torque X 3d Beta T2DShape3D

by David Everhart · in Torque X 2D · 11/29/2007 (12:21 pm) · 2 replies

Are there any samples that use this class? I know the class existed before in the stable version, and see it is flushed out in the 3d beta. I checked through the demos but didnt see any usage of it. I tried:

T2DSceneGraph currentSceneGraph = (T2DSceneGraph)TorqueObjectDatabase.Instance.FindObject("DefaultSceneGraph");
            T2DShape3D shape = new T2DShape3D();
            shape.SetShape(@"data/watercooler.dts");
            shape.SetPosition(new Microsoft.Xna.Framework.Vector2(0, 0), true);
            shape.SetRotation(0,true);
            shape.Size = new Microsoft.Xna.Framework.Vector2(500,500);
            shape.Visible = true;
            shape.Layer = 0;
            shape.ShapeScale = new Microsoft.Xna.Framework.Vector3(Convert.ToSingle(10));
            shape.Folder = currentSceneGraph.Folder;
            shape.DetailLevel = 0;
            shape.Components.AddComponent(new MovementComponent());
            shape.Components.AddComponent(new T2DPhysicsComponent());
            shape.TrackMountRotation = false;
            TorqueObjectDatabase.Instance.Register(shape);
            currentSceneGraph.AddObject(shape);

It shows up, but looks like it is being shown from a top down perspective. Any samples you can toss our way? :)

#1
11/29/2007 (1:45 pm)
You're going to want to mess with the Rotation2 property on T2DShape3D. It is specified using a Vector3 which is treated as euler angles (x is the rotation about the x-axis, y about the y-axis, and z about the z-axis).
#2
11/29/2007 (2:04 pm)
Ahh, thanks Adam. I was able to turn it around and it now shows up correctly. Ill mess with it and test out some animations . thanks again!! :)