Particles face camera

Blitz3D Forums/Blitz3D Programming/Particles face camera

Ross C(Posted 2003) [#1]
Very sorry for all these questions, but i'm also quite stuck on how to make my quads always face the camera. Try messing about with sin/cos, but to no joy :(


skidracer(Posted 2003) [#2]
I transform the "camera across" and "camera down" vectors into global space like this:
	TFormVector -1,0,0,cam,0
	camxx#=TFormedX()
	camxy#=TFormedY()
	camxz#=TFormedZ()
	TFormVector 0,-1,0,cam,0
	camyx#=TFormedX()
	camyy#=TFormedY()
	camyz#=TFormedZ()

and then position of the four corners of my quad using the following, first vertex is center+up+left, second if center+up+right etc
				x#=p\x-cyx+cxx
				y#=p\y-cyy+cxy
				z#=p\z-cyz+cxz
				VertexCoords surf,i,x,y,z
				x#=p\x-cyx-cxx
				y#=p\y-cyy-cxy
				z#=p\z-cyz-cxz
				VertexCoords surf,i+1,x,y,z
				x#=p\x+cyx-cxx
				y#=p\y+cyy-cxy
				z#=p\z+cyz-cxz
				VertexCoords surf,i+2,x,y,z
				x#=p\x+cyx+cxx
				y#=p\y+cyy+cxy
				z#=p\z+cyz+cxz
				VertexCoords surf,i+3,x,y,z

taken from http://www.blitzbasic.com/codearcs/codearcs.php?code=437


Loocipher(Posted 2003) [#3]
Um.

Why not just use the PointEntity command?


Rob(Posted 2003) [#4]
Because we are manipulating vertices. It's advanced programming.


Ross C(Posted 2003) [#5]
Ok, thanks alot for helping me out with this. I sorta just jumped into it, so this help is very much appreciated!