Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Loading a sparky's dll

Author
Message
Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 15th Mar 2008 11:17 Edited at: 15th Mar 2008 11:18
whne i load sparkys dll



then DBC stops responding and closes, does anyone know why?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Mar 2008 13:51
1. Do you have the enhanced version of DBC?

2. Is the dll in the same folder as your dba file?

TDK_Man

Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 16th Mar 2008 19:17
i have version 1.13 enhanced

yes it is in the folder...

Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 16th Mar 2008 21:04
ok, what i ahve discovered is that it is not the loading that is the trouble.
basicaly i can load it:



i can paste the intersect command in:



but then when I put in the code to call the function it no longer works even if it is not actualy calling it:



this might help, im not sure
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Mar 2008 02:52
One question I forgot to ask...

Did you read the instructions on how to install and use it?

As far as I'm aware there are core functions that have to be present whether you use them or not - some functions even call others.

Does the demo run OK?

If so, RTFM!

TDK_Man

Anto
19
Years of Service
User Offline
Joined: 30th Oct 2005
Location: Brisbane, AUS
Posted: 17th Mar 2008 08:52
G'day, Are you using Vista?

For me I never got sparkys to work on my computer, even tried some demo that others made up. My computer will always crash or won't run the program at all. I couldn't be bothered to work out or why. My bad. As I always used the DBC one

Anto.
Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 18th Mar 2008 22:00
Demo? theres a demo? where? i have read the instructions manual i think, is it the readme or the commands text file
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Mar 2008 00:13
Yes - the demo is called DBCcollisions.dba and is in the zip with the dll.

The installation instructions are in the file ReadMe.txt and how to call the functions is in the file Commands.txt.

The thing I think you have missed is item 2 in ReadMe.txt:

Quote: "2: copy the functions from the example source file to the end of your source file."


As you said:

Quote: "i can paste the intersect command in:

function intersectObjectDBC(objNum,groupFlag,oldx#,oldy#,oldz#,x#,y#,z#,excludeObj)
collide=call dll(1,"intersectObject",objNum,groupFlag,oldx#,oldy#,oldz#,x#,y#,z#,excludeObj)
endfunction collide"


..it suggests that you are pasting only the function you want into your own program rather than all of them like the text file says.

TDK_Man

Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 19th Mar 2008 19:44
I have pasted them all in, basicaly i had donwloaded the latest version of darkbasic but for some reason i had removed the stuff after a while and it had gone back to the older version (as it should) but it still said "v 1.13 enhanced" so i pasted in the files again and now it works, entirely my fault..

thanks to every one

codeeater
Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 19th Mar 2008 22:34
OK this is gettings annoyin, lol. Basicaly the above now works BUT... im using the intersect command but it doesnt seem to be detection the collision with the object. I have tried setting up the object using the setupobject command but it still doesnt work. anyideas?

codeeater

p.s am i right in tinking the intersect command basicly draws an invisible line from point a to point b to check if a certain object/group is on that line.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Mar 2008 00:04
Quote: "am i right in tinking the intersect command basicly draws an invisible line from point a to point b to check if a certain object/group is on that line."


Sort of. It draws an invisible line from the camera position to point b.

Load the demo dba file. Run it to see that it works OK on your system, then look at the code to see how the intersect function works.

TDK_Man

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Mar 2008 08:03
Quote: "p.s am i right in tinking the intersect command basicly draws an invisible line from point a to point b to check if a certain object/group is on that line. "


In general use, yes, a line is drawn from a start point to an end point and if it passes through an object, it will detect collision if that object is set up. But if you are talking about the demo specifically, like TDK said, the line is projected from the camera.

Here's an example that sort of shows what's going on. Use the left key and right key to change the length of the red line. The line represents the collision ray test. You'll have to save a copy of this code as a dba file in the same directory where "DBCcollisions.dba" is located. You'll notice that if the ray starts on the inside of the cube, it is not considered to be passing through it. Most likely has to do with how a bounding box is set up in the dll and how normals are used for the intersection formula.




Enjoy your day.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Mar 2008 10:27
Yes - sorry - I thought you were specifically talking about the demo.

Thanks for clarifying that Latch!

Are you using Groups or Objects?

You're going to have to post your code if you need any more help as the problem could be absolutely anything...

TDK_Man

Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 20th Mar 2008 13:40 Edited at: 20th Mar 2008 13:41
ok,,, i will only post the necessary bits as there is quite a lot of code:




explanation:

in "bikehit" it basicly first works out the position 500 in front of the player 1(object 1) (positioned at x#,y#,z#) and then draws the invisible line, using sparky's dll, from x#, liney#,z# to the position 500 infront of the player 1 (p500x# and p500z#) to see if object 6 collides in that line.

a# is the y rotate of player 1(object 1)

and the functions are the ones written by sparky.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Mar 2008 18:58
Sorry, but you just aren't giving enough info for anyone to help you.

From that code snippet, there's no way of us knowing what the intersectObjectDBC function parameters are when you actually make the call.

We also don't know what you do with the variable 'po'. For all we know, collision with object 6 is being detected but you are not handling it correctly.

You have text 0,0,str$(po), but haven't told us what it prints.

We also don't know how you set up the objects for collision, or if you the objects are being updated after being moved or rotated.

So, hardly the 'necessary bits'...

Anyway, I would start by doing the following:

po=intersectObjectDBC(6,0,x#,liney#,z#,p500x#,liney#,p500z#,0)
If po<>0 Then End


If the program doesn't stop, at least you know the object isn't being detected.

Next, I would create a couple of objects - and position one at x#,liney#,z# and the other at p500x#,liney#,p500z#. Doing this should confirm that the start and end of the ray is located correctly.

If all else fails, put your game to one side for a bit, start a new program with two cubes in it and get it to do what you can't do in your program.

TDK_Man

Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 20th Mar 2008 20:52
po is weather or not object 6 is on the intersect line.
so when i print po (text 0,0,str$(po)) it will be 1 if it has hit and 0 if it hasnt.
Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 20th Mar 2008 20:54
solved it! I just had to update the object thank you very much everyone!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st Mar 2008 00:20
Quote: "We also don't know how you set up the objects for collision, or if you the objects are being updated after being moved or rotated."


Yay! I win the prize for spotting it yes?

TDK_Man

Code eater
17
Years of Service
User Offline
Joined: 17th Feb 2008
Location: Behind You!
Posted: 21st Mar 2008 18:39
Yup!

Login to post a reply

Server time is: 2025-06-04 03:30:23
Your offset time is: 2025-06-04 03:30:23