trying to move one mesh rather than all of them

Started by
3 comments, last by fguihen 19 years, 4 months ago
ok, i have two classes, a room class that draws a room, and a person class that draws a simple representation of a person. each class contains its own methods to load and draw the meshes. the room mesh is supposed to stay still, and the person is supposed to move through the room. in the draw method for the person, i have the line "device.Transform.world = Matrix.Translation(0,0,value);" this line, which i thought would only move the person along the y axis, seems to move both the room and the person inside the room. i cant find out how to just move the person and keep the room still. any ideas.
I currently only use c# and directX9, in case its relivant and i didnt mention it in the post
Advertisement
Did you make sure that you called SetTransform for each mesh?
Since if you only call it once both meshs will move with the matrix, which you set.
afriad i didnt. can you explain how do that. i dont even think i used the SetTransform method once.
I currently only use c# and directX9, in case its relivant and i didnt mention it in the post
Setting the device.transform.world in managed directx is equivalent to calling SetTransform in the native d3d.

You need to use somewhat similar pattern to this:

-Begin frame
-Set world tarnsform for the object1's position
-Draw object1
-Set world transform for the object2's position
-Draw object2
-Repeat above for all distinct objects
-End frame

The currently set world matrix affects all geometry drawn after setting it. I think you're missing the point that the world transform can be changed arbitrary amount of times during the scene processing, not (necessarily) just once :)

Niko Suni

thank you. this should help me heaps.
I currently only use c# and directX9, in case its relivant and i didnt mention it in the post

This topic is closed to new replies.

Advertisement