moving quads
Blitz3D Forums/Blitz3D Programming/moving quads
| ||
Hi all. im having a hard time with somthing.. maybe one of you can help me out. I am making a grid(bunch o quads) wich share verts.. 4 verts per 2 tri. After its created I want to select any quad I want and move its verts on the z and or x axis , the connecting triangles should stretch any help yould be appreciated.. |
| ||
I wrote this to create function for the same reasons? The code could be cleaned up a bit. createsquare(segs#=2,parent=0) Segs = how many segments per side. i.e. grid=createsquare(10) Creates a 10x10grid with shared verts. http://www.blitzbasic.com/codearcs/codearcs.php?code=463 Also in the archive is the Mesh terrain by BadJim http://www.blitzbasic.com/codearcs/codearcs.php?code=362 It does a what you need and more! |
| ||
thanks but ive gotten that fAr. I want to select the verts in a specifed quad.. how can i do that. ok if i pick one triange.. how can i determine the other triangle that goes with it?? HMM it isnt as simple as picking.. getting picked triangle index number.. then if its odd the very next index it it? or if its even the prev index is it?? |
| ||
You could set up a type collection with each quad in it. Then have a type object for each quad, with the fieldType quad Field start_index End Type Now Store the index value of the first vertex created for each quad. Then use camerapick command and return the picked triangle. Then, use the TriangleVertex ( surface,triangle_index,corner ) to return the index value of ANY vertex (corner can be 0,1 or 2). Now, loop through all the types, and compare the index number to the index value held the the type like so... for q.quad=each quad If q\start_index=> picked_index and q\start_index =< picked index then found_index=q\start_index Exit End If Next This will return the picked_index values assciated start index. Now you have that number, you know which one of the vertexs you have selected basically. found_index-picked_index= the corner of the quad. |
| ||
woot! thanks |