|
Post by xenovacivus on Aug 29, 2006 14:28:43 GMT -5
Trouble with collision detection? Take out the hassle with this plugin! www.xenovacivus.50megs.com/main.html(my crappy site- it's the first link, right under "Basic4GL DLL!!!") There's a simple example program in that .zip file- you should be able to extract everything and double click either of the .gb files and run them. (you'd have to have the most recent version of basic4gl). Most of the specifics should be covered in the readme! file. So far, this is a very early version (the stuff doesn't work as effeciently as possible, but it works). I'll be updating it from time to time, so if there's a feature you want speak up and I'll add it in there.
|
|
|
Post by matthew on Aug 30, 2006 8:06:17 GMT -5
Hey xeno, yesterday I tried that 'Walkaround Demo' on your Site, it's excellent, really fast and the collision detection is great.  ;D 
|
|
|
Post by xenovacivus on Aug 30, 2006 15:20:37 GMT -5
thanks! The same collision detection in the walkaround demo is in the .dll. The walkaround demo is entirely c++, but a basic4gl program using the .dll for collision detection runs almost as fast.
If you downloaded the "collision detection .dll" there's a basic4gl program in there (walkaround mapmaker) and you can load the same map as in the c++ program, to compare frame rates (the camera doesn't move as fast, but thats got more to do with the camera speed). The map is called "largemap2.obj", just hit return and type "load largemap2.obj" into the basic4gl program after running it, then it should load. Plus, you can click on polygons and stuff and move them around, or make new ones! There's a readme on how to use the program...
And the collision detection .dll isn't that hard to use, either. If you can draw the polygons to the screen, you can use the collision detection! The function syntax for settinging a polygon into the collision detection is the same as drawing a polygon, except the "gl" is replaced with "cd". For exactly how to do it, check out the basic4gl example program that comes with the .dll.
Also, since I'm pretty sure I failed to mention it anwhere else, the collision detection uses a 1.5 unit radius sphere around whatever point it's checking for collision detection. I'm going to include stuff for using an eliptical bounding box of different sizes in the next version, but what's there works for now.
|
|
|
Post by matthew on Aug 30, 2006 15:48:14 GMT -5
I'm going to try your Collision Detection.dll and Basic4GL programme right now. 
|
|
|
Post by davy on Aug 30, 2006 15:56:46 GMT -5
Any possiblity of making a line to triangle routine? That way projectiles and stuff can be tested, I've been working on one, but haven't had much luck for some reason... Also, I talked to Tom about the array loading thing...
A dot product command could be made like this (Yes, I know that you can do this in basic4gl already by saving vec3(1,2,3)*vec3(1,2,3) its just an example)
void DLLFUNC Func_DotProduct(IDLL_Basic4GL_Runtime &basic4gl) { float result; float veca[3]; float vecb[3]; basic4gl.GetFloatArrayParam(2, veca[0], 1, 3); basic4gl.GetFloatArrayParam(1, vecb[1], 1, 3); result=veca[0]*vecb[0]+veca[1]*vecb[1]+veca[2]*vecb[2]; basic4gl.SetFloatResult(result); }
and you would register it with...
registry.RegisterFunction("DotProduct", Func_DotProduct, DLL_BASIC4GL_FLOAT); registry.AddArrayParam(DLL_BASIC4GL_FLOAT, 1); registry.AddArrayParam(DLL_BASIC4GL_FLOAT, 1);
For some reason you have to dim the variable to 3, instead of 2... So there will be an empty space... But, it works
|
|
|
Post by matthew on Aug 30, 2006 16:27:43 GMT -5
I've just tried your Basic4GL Collision Detection programme and I think it's superb. ;D
I also tried loading some of the other terrains like the 'Holy Mountains', they looked really good and the Collision Detection is 'spot-on'.
|
|
|
Post by xenovacivus on Aug 31, 2006 3:26:18 GMT -5
Thanks again, mathew. I appreciate the support!
And thanks to davy for the array stuff. I'll try it out soon, and should have some more stuff for the .dll as well. There is a function in there for ray/polygon collision, I use it in selecting polygons for the walkaround mapmaker (ray polygon is the same as bullet/polygon). but it does need some work...
Also, arrays are a little different in c++. declaring an array float vec3[3] means you have exactly 3 parts in the array. I learned this the hard way, since it is possible to do float array[2]; array [5] = 10. There are no errors thrown when you go outside an array, instead it accesses whatever data is 5 floating point values from array [0]. For example,
int a[2]; int b[2];
a[0] = 4 // assign data to the array. a[1] = 7 // more data... this is the last element in the array.
a[2] = 9 // the data is now outside the array.
cout << b[0] << endl; // will print "9" to the screen, because the data overflowed from array "a" to "b" with a[2] = 9.
(There is no guarentee the data will flow into the next variable, that has just been my experience)
I dont know why I go about giving these lengthy explanations... In short, a c++ array has exactly how many elements are in the brackets opun assigning. array [2] has 2 elements, array [5] has 5 elements. When accessing the array, you start with 0, so array [2] would be 0 and 1. array [5] would be 0-4.
I will add some quick and easy collision detection functions to the .dll also, where you can test a polygon with something else in one function rather than setting the polygon and then testing it...
|
|
|
Post by James :) (aka Madcow) on Oct 14, 2007 3:18:18 GMT -5
needs to be update to the new SDK or released to source code so others an do it.
|
|
|
Post by xenovacivus on Oct 14, 2007 14:58:34 GMT -5
I'll put the code somewhere and/or update the .dll... if I can find it...
I think this .dll is pretty much obsolete in comparision to the Ogre physics engine plugin that's out there somewhere (perhaps it needs to be updated too?).
|
|
|
Post by James :) (aka Madcow) on Oct 14, 2007 15:49:00 GMT -5
can OGRE work with basic4gl too?, if so where can i download the DLL?
|
|
|
Post by xenovacivus on Oct 15, 2007 8:02:30 GMT -5
|
|
|
Post by DJLinux on Oct 27, 2007 7:37:26 GMT -5
Hello xenovacivus curent version of Basic4GL won't load your collision plugin here any idea why?  or any extra lib are needed? Joshy
|
|
|
Post by matthew on Oct 27, 2007 7:58:26 GMT -5
...curent version of Basic4GL won't load your collision plugin here any idea why?.. The Source code for the .dll probably needs to be recompiled with the new Plugin SDK.
|
|
oo7
Newish
My name is Bond.... James Bond
Posts: 15
|
Post by oo7 on Oct 31, 2007 13:41:49 GMT -5
I've got that message too. Just start a blank b4gl screen file->pluginlibraries select the plugin and open the program now
|
|
|
Post by James :) (aka Madcow) on Oct 31, 2007 17:21:43 GMT -5
bascly tom added a new plugin system that changed the way functions registered (somthing to do with stacks). but the new one dose not register the old ones. this plugin has been compiled with the old one so it won't work.
|
|