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.

Dark GDK / Raycast always returning 0

Author
Message
ChrisGDK
14
Years of Service
User Offline
Joined: 18th Dec 2009
Location:
Posted: 27th Jun 2012 04:11
Hello, I just recently started using DBPro Collision (Sparky's) and was trying to cast a ray and no matter what I do it always returns 0. I am using Dark GDK 2.0 RC4. Any ideas?

Here's my code..

Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 27th Jun 2012 13:39
Have you tried compiling gdkengine.dll with "Include Plugins" option turned on. By default after installation it builds only core libraries.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
ChrisGDK
14
Years of Service
User Offline
Joined: 18th Dec 2009
Location:
Posted: 27th Jun 2012 20:23
I ran the "compile engine with plugins.bat" but and replaced the old gdkengine.dll with this one but it didn't make a difference.

Can you notice any problems with my code? (Other than the */ and the } after dbSync() that I forgot to take out.)
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 28th Jun 2012 23:06
Quote: "int Land = dbCreateObjectBox(500, 5, 500, 10); "


Your box is 5 wide, 500 high, and 10 deep, at 0,0,0.

Quote: "y = SC_RayCast(500, 0, -20, 0, 0, 20, 0, 0);"


You're casting a ray from -20 to 20 on the y axis, vertically. This entire ray is entirely inside the box, and will never intersect any of it's sides, so there will be no collision.

ChrisGDK
14
Years of Service
User Offline
Joined: 18th Dec 2009
Location:
Posted: 29th Jun 2012 02:14
Quote: "
Quote: "int Land = dbCreateObjectBox(500, 5, 500, 10); "

Your box is 5 wide, 500 high, and 10 deep, at 0,0,0.

Quote: "y = SC_RayCast(500, 0, -20, 0, 0, 20, 0, 0);"

You're casting a ray from -20 to 20 on the y axis, vertically. This entire ray is entirely inside the box, and will never intersect any of it's sides, so there will be no collision.
"


DGDK 2.0 has the ID on the far right when creating objects, so it's actually 500 wide, 5 high and 500 deep.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 30th Jun 2012 00:10 Edited at: 30th Jun 2012 00:11
Ahh, ok. Sorry, not used GDK 2.0. If that's the case, what is the first parameter in the sc_raycast call? (Don't have help files to hand). If that's the object ID, shouldn't it be 10? Or int 'land'?

ChrisGDK
14
Years of Service
User Offline
Joined: 18th Dec 2009
Location:
Posted: 30th Jun 2012 04:36
Corrected that but still returns 0...

Here are the parameters... I wonder if anyone has successfully used this function since DGDK 2.0 or if it's just me.

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 30th Jun 2012 11:17
Next thing then ...

Quote: "int Land = dbCreateObjectBox(500, 5, 500, 10);"


What is returned by dbCreateObjectBox? Is it the ID? If so, what's the point of the 10 at the end of the command? Could it be that what's returned is something else? If so ...

Quote: "SC_SetupObject(Land, 1, 2); "


Then you'd need to plug 10 into this command, rather than land. Again, just guess work as I've not used GDK2!

Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 30th Jun 2012 12:05
Fallout is right. GDK 2.0 can assign ID's automatically so there's no need to force them.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
ChrisGDK
14
Years of Service
User Offline
Joined: 18th Dec 2009
Location:
Posted: 1st Jul 2012 02:22 Edited at: 1st Jul 2012 02:26
I didn't know if the ID assigned to the first object created was 0 or not so just to make sure I didn't get confused and have a 0 returned on raycast I just set it to 10.
I changed the code to what was suggested and it didn't make a difference.

If anybody has DarkGDK 2.0 (or wishes to take the time to download it) and set up a raycast demo using DGDK 2.0. I would really appreciate it.

Login to post a reply

Server time is: 2024-04-19 16:30:20
Your offset time is: 2024-04-19 16:30:20