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 / Missing ray cast command help

Author
Message
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 3rd Aug 2006 18:00 Edited at: 3rd Aug 2006 18:08
Just thought I'd mention that the command phy ray cast all shapes appears to be missing from the reference help and is only partially detailed in the Information help. All the information gathering commands for ray casting are there, it's just the ray casting one itself, so pressing F1 in DBP on that command comes up with a missing help file error. There is sufficient info in the Information help to understand how it works though.


Edit: Ooops. I tell a lie. The syntax gets highlighted, but it says it can't understand the command at compile time.

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 3rd Aug 2006 18:14 Edited at: 3rd Aug 2006 18:31
Here's a very simple example. You can't compile it.



Edit: Is there perhaps a hidden ray cast command that wasn't enabled? At the moment I'm using this code:



... to allow my character to push anything within 20 units in front of him on a key press, and it all compiles fine except for the ray cast command itself.

Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 3rd Aug 2006 18:36
This command returns a value so you need to use it like this:



I'll check the string table as well just in case it confuses DB Pro. It should say something about brackets needed for this command.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 3rd Aug 2006 18:40
Ahhh. Thanks Mike. That makes perfect sense. The only documentation on that command that I could find was in the Information help file showing this format:

phy ray cast all shapes 0, 10, 0, 0, -1, 0

What are the values that get returned btw, or is it just a generic value return like the make vector commands?

Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 3rd Aug 2006 18:46
There's a tutorial on ray casting that will point you in the right direction. These are the main points from the tutorial:

int = phy get ray cast hit ( ) – returns a value of 1 if the ray cast has hit an object, a value of 0 is returned when the ray cast did not hit any objects

float = phy get ray cast hit point x ( ), the position in world space on the X axis where the ray cast hit an object

float = phy get ray cast hit point y ( ) , the position in world space on the Y axis where the ray cast hit an object

float = phy get ray cast hit point z ( ) , the position in world space on the Z axis where the ray cast hit an object

float = phy get ray cast hit normal x ( ), the normal ( direction ) where the impact took place on the X axis

float = phy get ray cast hit normal y ( ) , the normal ( direction ) where the impact took place on the Y axis

float = phy get ray cast hit normal z ( ) , the normal ( direction ) where the impact took place on the Z axis

float = phy get ray cast distance ( ), the distance from the origin to the hit point

int = phy get ray cast object ( ), the ID number of the object that was hit by the ray
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 3rd Aug 2006 18:46 Edited at: 3rd Aug 2006 18:48
Sorry Mike, I am guilty of just looking at the reference files and getting stuck in. I will check the tutorials from now on aswell.

Btw, is there a command to determine if a rigid body is dynamic or not? If I add a force to the object my ray cast hits and it's a static mesh, I get an error (not surprisingly). I can't find a command to determine if the object I've ray cast into is a dynamic mesh, which poses problems with applying forces to unknown objects you collide with.

Edit: Obviously I can keep track of this in an array myself if needs be, but I can't see a get rigid body property to access this info.

Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 3rd Aug 2006 18:52
That's one thing I don't believe we have in. Will get a command sorted out for the update.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 3rd Aug 2006 19:14
Brilliant! Thanks.

Sorry for more bad news btw. As I was testing out Drake pushing open doors, I noticed he had powers of telekinesis. So I kept reducing the distance at which he could open a door, but sure enough he could open it from across the level. So I adapted the Ray Casting tutorial demo to display the distance of the ray cast and it always seems to return 0. I don't believe I'm using it incorrectly.

Code here:



Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 3rd Aug 2006 19:49
Actually, none of the commands work except for the ray cast, the hit command and getting the object. Here's an example:



Mike Johnson
TGC Developer
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 7th Aug 2006 12:51
All ray cast commands now updated. Was a casting problem.
Lani
17
Years of Service
User Offline
Joined: 14th Aug 2006
Location:
Posted: 13th Sep 2006 10:43 Edited at: 13th Sep 2006 13:40
Which version of DB/DP is this update active from?

ps / am I the only one that can´t get Fallout's example to compile ? I can an error that says that the command "phy get ray cast hit()" is not working, which is rather strange.. but maybe that was the point?

Login to post a reply

Server time is: 2024-04-20 03:58:16
Your offset time is: 2024-04-20 03:58:16