Jump to content
  • Advertisement
Sign in to follow this  
sharix

Moving individiual objects in Direct3D

This topic is 5128 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings to everyone, I bought many books and also read many tutorials. I always read about "moving the camera", "transforming", "rotating" and etc. But all those things seem to be for whole scene. Assume that you have 1000 objects in the scene. The objects may vary from meshes to plain triangle primitives. How should/do I move/rotate/scale some of these(for example move only 20 objects as others remain the same) ? So, how should/do I change positions of some vertices while keeping remaining the same? Almost everyone says not to lock vertexbuffers, textures and etc. Is there a way to manipulate vertices without locking anything? Or should I use dynamic buffers for vertices that I have to change? Please help, that's really annoying me.

Share this post


Link to post
Share on other sites
Advertisement
Well, I am not sure if my post will be of much help, but here is my understanding of things:

When you render each object, you can set up different transformations. Suppose you need several (out of however many objects in your scene) to move. You could transform those objects that are moving by the appropriate matrix to result in the desired motion. If objects aren't moving, then they are only transformed by a transpose matrix (one which doesn't change the position/orientation of the object). There is no need to lock/unlock vertex buffers if objects are moving but the vertices themselves aren't changing positions relative to eachother.

Suppose you have an object, such as a box, that is getting knocked around your scene. Because the actual vertices of the box don't change in relation to eachother, you could use a matrix to move the box in the scene. You could set up a matrix with the right amount of rotation/translation to move the box where you want it.

I hope that helps...

Share this post


Link to post
Share on other sites
well , i try to help
in 3d environment, we define mesh, triangle, or other things that goes to render is in Local Position.
When we want to draw anything in our screen, first we oriented in world position, and then draw that things. Don't need to lock vertex buffer.
So the steps is:
//init geometry
1. define polygon in local position
2. lock vertex buffer, and feed your vertices to vertex buffer, then unlock it

//oriented polly
1. transform the vertices (scale, rotate, translation)
2. set the world position
3. draw that scene

and viola... you change that object position without changing or locked vertex buffer. I hope it can help u.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!