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 Physics & Dark A.I. & Dark Dynamix / Dark Physics - Ray Casting problems (again)

Author
Message
Kaisertal
16
Years of Service
User Offline
Joined: 21st Oct 2008
Location: The Netherlands
Posted: 5th Nov 2008 22:25
I'm trying to cast multiple rays using vectors, but apparently this command:

phy ray cast all shapes ( x#, y#, z#, 0, -1.0, 0 )

only accepts values of 1.0 and -1.0 and nothing in between like 0.5

Browsing this forum (and just typing in DBPro and seeing what is recognized) I found several undocumented alternative commands like:
phy ray cast ( x#, y#, z#, 0, -1.0, 0 , 0)
and
phy ray cast closest shape ( x#, y#, z#, 0, -1.0, 0 )

But all of these give very different or no results when using them in the Ray Cast example file.

Any advise here would be appreciated!
wh1sp3r
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Czech republic
Posted: 6th Nov 2008 19:59
http://forum.thegamecreators.com/?m=forum_view&t=139005&b=15

... horrible, terrible...

PS: Real programmers aren't afraid of math!.

AMD 64x 3500+, 6GB RAM, GeForce 8800 GTS 320MB, HD 500GB, X-fi xtreme audio, Internet 10/1 Mbit
Kaisertal
16
Years of Service
User Offline
Joined: 21st Oct 2008
Location: The Netherlands
Posted: 7th Nov 2008 00:20
So I've paid 39 euros for a physics add-on that doesn't have its most basic function - ray casting - working?
peterJBE
16
Years of Service
User Offline
Joined: 11th Mar 2008
Location: Belgium
Posted: 7th Nov 2008 18:23
@Kaisertal
In the DarkPhysics ray cast tutorial I replaced:
value = phy ray cast all shapes ( x#, y#, z#, 0, -1, 0 )
by
value = phy ray cast all shapes ( x#, y#, z#, cos(45), -sin(45), 0)

and it seems to work (I can cast a non vertical or non horizontal ray). So it seems that we can use other values than 1 or -1
Kaisertal
16
Years of Service
User Offline
Joined: 21st Oct 2008
Location: The Netherlands
Posted: 8th Nov 2008 10:00 Edited at: 8th Nov 2008 11:27
Yes thanks, that seems to work, however when I look at the values

cos(45) = 0.707106769085
-sin(45) = -0.707106769085

and use the first 4 numbers

a# = 0.7071
b# = -0.7071

in 'value = phy ray cast all shapes ( x#, y#, z#, a#, b#, 0)'
the ray cast still works, BUT if you change the numbers

e.g. :
a# = 0.707 and b# = -0.707
or
a# = 0.7072 and b# = -0.7072

the ray cast ceases funtioning.

Also it looks like you have to do a sin and cos on the same value otherwise it doesn't work either. So sin(45) and cos(44) doesn't do anything.

Maybe i'm doing something wrong here, but it smells fishy
peterJBE
16
Years of Service
User Offline
Joined: 11th Mar 2008
Location: Belgium
Posted: 9th Nov 2008 18:15
@kaisertal
I experimented somewhat further with the ray cast tutorial.
The following adaptation shows how you can pass a ray trough two
points. A valid direction vector is calculated.
As such the program does not make much sense.
The ray is always going trough the box on the right.
Kaisertal
16
Years of Service
User Offline
Joined: 21st Oct 2008
Location: The Netherlands
Posted: 12th Nov 2008 12:03
Thanks for the code peterJBE,

I've tried it in my game and it does give some results but only at certain angles 90 and 270 degrees
FINN MAN
20
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 12th Nov 2008 17:11
I do not think that it use degrees think it use radians.

radians = degrees(3.14/180)

Kaisertal
16
Years of Service
User Offline
Joined: 21st Oct 2008
Location: The Netherlands
Posted: 12th Nov 2008 18:37
I've tried something else using Vectors and somehow that seems to work in this test program.

So the real problem might be somewhere in my own game's code.

Login to post a reply

Server time is: 2024-11-24 18:41:12
Your offset time is: 2024-11-24 18:41:12