Help: Mesh vector location?

Started by
1 comment, last by LaneGresham 18 years, 1 month ago
/*This is in a RenderWorld class that I made for a game im making. Im having a problem with picking/setting a vector location with in the mesh, the mesh in the code, under the Obj.Mesh down below. If some one can help me findout how to get the meshs vector location, that would be sweet, thanks.*/ //Note: this is C# #region RenderWorld_Functions public void OnCreateDevice(object sender, DeviceEventArgs e) { Model NewModel = null; NewModel = new Model(ref e.Device); NewModel.Load("tiger.x"); ModelList.Add(NewModel); } public void OnResetDevice(object sender, DeviceEventArgs e) { e.Device.Lights[0].Type = LightType.Directional; e.Device.Lights[0].Diffuse = System.Drawing.Color.FromArgb(255, 255, 255); e.Device.Lights[0].Direction = new Vector3(0.0f, 0.0f, 8.0f); e.Device.Lights[0].Enabled = true; e.Device.Lights[0].Update(); e.Device.Lights[1].Type = LightType.Directional; e.Device.Lights[1].Diffuse = System.Drawing.Color.FromArgb(255, 255, 255); e.Device.Lights[1].Direction = new Vector3(0.0f, 0.0f, -8.0f); e.Device.Lights[1].Enabled = true; e.Device.Lights[1].Update(); e.Device.Lights[2].Type = LightType.Directional; e.Device.Lights[2].Diffuse = System.Drawing.Color.FromArgb(255, 255, 255); e.Device.Lights[2].Direction = new Vector3(0.0f, -0.33f, 0.66f); e.Device.Lights[2].Enabled = true; e.Device.Lights[2].Update(); } public void OnDestroyDevice(object sender, EventArgs e) { Model Obj; for (int i = 0; i < ModelList.Count; i++) { Obj = (Model)ModelList; if (Obj != null) Obj.Dispose(); } } public void OnFrameRender(Device device, double appTime, float elapsedTime) { device.RenderState.Lighting = true; device.RenderState.Ambient = System.Drawing.Color.White; Model Obj; for (int i = 0; i < ModelList.Count; i++) { Obj = (Model)ModelList; Obj.Render(); // where the mesh object is located <---- } } #endregion
Advertisement
I don't really use MDX, so bear with me for a sec. Is Model your own class? If so, you should have some kind of interface for setting / getting its position (like GetPosition() & SetPosition(), ect..)

I don't quite understand your question - maybe explain it in a little more detail.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Yes model is my own class, I just figured it out lastnight! i needed a device for each of my meshs to change the location. it was somthing like this:

int x = 0,y = 0,z = 0;
myLandMesh.deviceRef.Transform.World = Matrix.Translation(x, z, y);

"myLandMesh is a Model class"

This topic is closed to new replies.

Advertisement