Linepick collision
Blitz3D Forums/Blitz3D Programming/Linepick collision
| ||
..I would like to see some nice example of use Linepick for collisions with terrain or mesh level geometry since I am not understanding exactly this linepick thingy regarding parameters I have to provide for this command...anyone can post some nice example code with explanation regarding Linepick's parameters actually.. |
| ||
Well it's quite straightforward really. The first set of params specifiy the starting point of the line pick and it's important to note that the second set are the vector to the end point, not the end point itself. e.g. LinePick 0,-10, -50 , 0,100,60 Will check picks between a line from 0,-10,-50 to 0,90,10. Stevie |
| ||
There is another example (with pseudo code):If meshmodel moves front LinePick(EntityX(meshmodel), EntityY(meshmodel), EntityZ(meshmodel)+dz if meshmodel moves back LinePick(EntityX(meshmodel), EntityY(meshmodel), EntityZ(meshmodel)-dz if PickedNY(() < 0.85 then StopMeshModel() . . . etc You can experiment with 0.85 and dz I use the same method on my Xplorer game I am working on. Take a look it works great |
| ||
Moraldi, I think your codes lines got clipped. Try again. |
| ||
No, not clipped, I was just very harryIf meshmodel moves front LinePick(EntityX(meshmodel), EntityY(meshmodel), EntityZ(meshmodel)+dz Endif if meshmodel moves back LinePick(EntityX(meshmodel), EntityY(meshmodel), EntityZ(meshmodel)-dz endif if PickedNY(() < 0.85 then StopMeshModel() . . . etc Now its correct and more clear |
| ||
Moraldi, As John is pointing out, your LinePicks don't have a pick direction vector so will give you an error on compile. Stevie |
| ||
Oh guys, I am very sorry (I am laughing with my self, here in Greece we say that when a man makes the same mistake for a second time then he is not a wise man...). Here we are:If meshmodel is onground maxradius = Max(meshmodel_collision_xradius, meshmodel_collision_yradius) If meshmodel moves front LinePick(EntityX(meshmodel), EntityY(meshmodel), EntityZ(meshmodel)+dz, 0, -2*MeshHeight(meshmodel), 0, maxradius) Endif if meshmodel moves back LinePick(EntityX(meshmodel), EntityY(meshmodel), EntityZ(meshmodel)-dz, 0, -2*MeshHeight(meshmodel), 0, maxradius) endif if PickedNY(() < 0.85 then StopMeshModel() endif . . . etc No comments... |