Sign in to follow this  
LaneGresham

Help: Mesh vector location?

Recommended Posts

LaneGresham    132
/*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[i]; 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[i]; Obj.Render(); // where the mesh object is located <---- } } #endregion

Share this post


Link to post
Share on other sites
circlesoft    1178
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.

Share this post


Link to post
Share on other sites
LaneGresham    132
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"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this