#### Archived

This topic is now archived and is closed to further replies.

# Move vertex forward

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

## Recommended Posts

Has anyone got some kind of wrapper function that will move an vertex forward, or can someone explain how it is done? What Im trying to get to grips with is working out where "forward" actually is in 3d space after applying a matrixes to rotate a vertex / object.

##### Share on other sites
Hi,

well it depends on what you want to do... your problem isn''t completely clear to me, but I will try to explain.

Suppose you have a vertex in a polygon and you want to move that forward.... then just use the crossproduct on 2 edges of the polygon and it will give you the normal vector.

Another option is: Just keep the transform matrix... When the transform matrix is rotated, translated, scaled... the axis will point in the correct direction. So if before any transformation you said that the x-axis was forward... just apply the transformation and use the x-axis agian... since this will still be forward.

I hope I was of any help, Dark

##### Share on other sites
First figure out where it is you want "forward" to be.

Next make a vector from the center of the object to a point that is in front of it(depends on what you defined as front of course).

Now make the size of the vector be whatever speed you want the object to move at.

To move it forward now, just add the x value of the vector to all x values of points of the object, and the same with y and z values (a vector is just basically the difference between 2 3D points, making it be exactly like a 3d point, which is the reason I use the same structure for both vectors and points)

On a final note, remember to rotate the vector together with any rotation you make to the object(if for example you multiply all the points in the object by a rotation matrix, do that to the vector also) otherwise the front will not stay constant.

Hope this helps.

##### Share on other sites
The usual way of moving a model forward is by setting a world matrix for it. Exported models are resist in its local coordinate, therefore we will need a world matrix to define the model position within the world coordinate. The world matrix may consist of translation, rotation, etc.

So basically you set the world matrix in the pipeline (which will do the matrix multiplication in hardware if hardware acceleration exist) then all vertices in your model will be multiplied by the matrix, giving them new positions in the world coordinate.

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632992
• Total Posts
3009755
• ### Who's Online (See full list)

There are no registered users currently online

×