Rotating children, without parenting

Blitz3D Forums/Blitz3D Programming/Rotating children, without parenting

Ross C(Posted 2003) [#1]
Hey, i'm a wee bit stuck with how i would rotate particles round a certain point. For example:

My particle system is single surface so i can't parent the mesh to a pivot and rotate the pivot, because then all my particles would rotate around it. Any ideas?


Rob(Posted 2003) [#2]
You need Tformpoint to rotate the vert point around another point. Do it to all four points of a quad...


Ross C(Posted 2003) [#3]
hi, thanks for your reply, but how do i specify how much rotation i want? I don't really get how the Tformpoint command works :(


Rob(Posted 2003) [#4]
From my own single surface particle system (source'll be released when I'm bored of it):
TFormVector -s\s,-s\s,0,camera,0 
VertexCoords s\surf,s\verti[0],s\x+TFormedX#(),s\y+TFormedY#(),s\z+TFormedZ#()

TFormVector s\s,-s\s,0,camera,0 
VertexCoords s\surf,s\verti[1],s\x+TFormedX#(),s\y+TFormedY#(),s\z+TFormedZ#()

TFormVector -s\s,s\s,0,camera,0 
VertexCoords s\surf,s\verti[2],s\x+TFormedX#(),s\y+TFormedY#(),s\z+TFormedZ#()

TFormVector s\s,s\s,0,camera,0 
VertexCoords s\surf,s\verti[3],s\x+TFormedX#(),s\y+TFormedY#(),s\z+TFormedZ#()


Whats interesting? well s is our scale! for a quad, it's even on all sides! the scale is tformed by the rotation in tformvector As you can see, they are tformed to the camera space..... ;)


Ross C(Posted 2003) [#5]
Um....sorry for being kinda stupid, but how do a specify how muh rotation i want. Say i want to rotate my quad around 0,0,0 by 40 deg. Again, i appreciate your help, but as you can tell, i'm a wee bit clueless :)


Rob(Posted 2003) [#6]
This is a single surface particle: it always faces the camera. To rotate it a certain point from here, is exactly like rotating 4 pixels in 2D: you use our friends cos and sin.

x=x+cos(rotation)*dist
y=y+sin(rotation)*dist

Where dist is the amount between them. In our example above, thats s for scale.

You add it into the final equation - this will give results like rotatesprite - I am assuming you want that behaviour? because moving a bunch of verts is simplicity - you make the vert positions = pivot position.


Rob(Posted 2003) [#7]
Code archives has a single surface thing if you're interested.


Ross C(Posted 2003) [#8]
Thanks for your help on this. The rotation i'm looking to do is the same as a sprite, ie. rotating all axis's. No doubt i'll be back here asking for help some :o)

One ideas i did have tho, was to create a mesh consisting of 1 quad, then rotate this quad to the desired rotation, then use it's vertex positions to position each quad. I think this might be a wee bit slower tho, as i'll need to rotate the quad into place for each particle.