Skip to main content
gamedev.net
🔒 Locked

Drawing multiple mesh objects

Started by MetalGod01 4 replies 350+ views
Original Post
MetalGod01
MetalGod01
Hey, I''m having some trouble drawing multiple mesh objects on the screen, in different locations. Here is a code snippet to give you an idea of what I''m trying to do. One rotating object (earth), and a satellite rotating around it. Not working! //Draw the earth objectOne.RotateY(Environment.TickCount/5000.0f); device.Transform.World = objectOne; earth.Draw(); //Draw the satellite objectTwo = objectTwo * satScaleMat; objectTwo = objectTwo * satTranslateMat; objectTwo = objectTwo * satRotateMat; device.Transform.World = objectTwo; satellite.Draw(); If this is too hard to exaplain, is there a good tutorial which explains this? Most basic tutorials I find stop after explaining how to draw one object.
Pilatus
Pilatus
i have just one comment :
>.<
RaphaelMun
RaphaelMun
When object1 is rotating and object2's rotation focus is changing because of object one, that would mean object2's transformation matrices will have to change depending on object1's new positions each frame. So basically you'll have to get object1's new position and set the translation matrix based on that. The scale matrix and the rotation matrices should be fine the way it is. I hope that made sense. Good luck dude!

EDIT: I'm not sure if I understood your question correctly actually. Is your question just a matter of drawing two different objects on the screen of drawing them based on one another? In drawing multiple objects your code (like mentioned above) isn't enough information. You would have to Start the direct3d device to draw and then drawprimitive (which i hope is what your Draw() does) multiple times (once for each object i guess depending on how many vertex buffers you have) and then End. But the matrix calculations can be done beforehand.

[edited by - RaphaelMun on July 17, 2003 3:09:23 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.