#### Archived

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

# Particle engine: reverse rotation

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

## Recommended Posts

I am programming a new particle engine to work with my new camera class. This new camera class doesn''t store the rotations anymore but instead works directly on the modelview matrix. When drawing the particles I need to orient them towards the camera. How can I rotate the particles towards the camera using only the modelview matrix info? I would really prefer a fast routine since I need to have *lots* of particles. Thanks in advance! Sander Maréchal

##### Share on other sites
the modelview matrix, isn''t one row = up vector, another row = right vector, third row = direction vector ?

the simplest way is to use the up vector as y-axis and right vector as x-axis for your bilboard

"No lies of sugar can sweeten the sournes of reality"

}+TITANIUM+{ A.K.A. DXnewbie[onMIRC]

##### Share on other sites
As Seriema said, you can extract the axes directly from the view matrix. If you''re using D3D..

		m_pD3Ddevice->GetTransform( D3DTS_VIEW, &viewMatrix);		Xaxis.x=viewMatrix._11;		Xaxis.y=viewMatrix._21;		Xaxis.z=viewMatrix._31;		Yaxis.x=viewMatrix._12;		Yaxis.y=viewMatrix._22;		Yaxis.z=viewMatrix._32;		Zaxis.x=viewMatrix._13;		Zaxis.y=viewMatrix._23;		Zaxis.z=viewMatrix._33;

The method for OGL would be similar. Then you use the x-axis and y-axis as offsets for the corners of each billboard.

##### Share on other sites
Ahhhhh.... stupid, stupid me

Why could I not think of that myself. It makes sooo much sence and I knew that those vectors were storen in the modelview matrix.

Thanks a lot guys!

One last question: The vectors stored in the modelview matrix (OpenGL), are they already normalized? Or would I need to do that manually?

Sander Maréchal

1. 1
2. 2
3. 3
Rutin
17
4. 4
5. 5

• 10
• 14
• 30
• 13
• 11
• ### Forum Statistics

• Total Topics
631787
• Total Posts
3002354
×