Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rotating particles

Started by stupid_programmer Aug 30, 2008 at 2:57 AM 1 replies 450+ views
Original Post
stupid_programmer
stupid_programmer
I want to have my particles to be able to rotate so I'm using a vertex buffer to hold the data to all the quads for a specific particle effect. I want all the particles to have a different starting rotation angle and then go from there. Is there no better way then set the world translation and then render one quad, then set a new world translation and then render the next quad? Its the only way I can think of but I'm trying to get away from having entities render themselves.
Headkaze
Headkaze
Just use a matrix transform on all your quad's verticies and it will rotate a single quad. That way you can render all of them at once.

Don't forget you will have to translate it -(width / 2) and -(height / 2) then rotate then translate back (width / 2) and (height / 2). That way it will rotate from the centre.
stupid_programmer
stupid_programmer
Quote:
Original post by Headkaze
Just use a matrix transform on all your quad's verticies and it will rotate a single quad. That way you can render all of them at once.

Don't forget you will have to translate it -(width / 2) and -(height / 2) then rotate then translate back (width / 2) and (height / 2). That way it will rotate from the centre.


I guess I don't understand this. Right now my vertices are just x,y,z and u,v so I don't see how I could do any transforms on them before putting them in the vertex buffer.

*edit*
After some poking around I found that D3DXVec3Transform() does what I need it to do. Thanks.

[Edited by - stupid_programmer on August 30, 2008 1:32:35 PM]

Topic Locked

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

Sign in to reply to this topic.