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.

Author
Message
Ninja_Je5us
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 8th Mar 2011 13:28
Hi all,

Im trying to use raycasting in a flight game that I am working on, as this was better for memory management than my previous aim of creating a sphere for every bullet.

My code for this is very simple and most probably wrong, (as I am still unsure of how to use the raycasting), and because of this it doesnt seem to do anything. Can anyone point me in the right direction?

Here's my code:

The code used when an object is hit, after a ray is cast:



The code used to cast the ray, notice that it calls rayCastHit:



The code that calls the rayCastFire function:



Just so you get the picture, object 1 is a fighter plane.

Regards
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 8th Mar 2011 14:56
Ninja_Je5us to save you thinking the above may be wrong make a small demo to prove that dbDeleteObject( objectnumber ); does do its job as in Darkbasic it doesn't.

if doesn't work you might be able to delete it using the actor system as you would if writing direct in c++.

Dark Physics makes any hot drink go cold.
Ninja_Je5us
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 9th Mar 2011 11:48
It does as I expected it to. To test it I simply put



This deleted a building from my landscape when I pressed the "V" button.

Is there anyway that I can truly test whether or not my raycasting code is the problem?
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 9th Mar 2011 15:42
have you gone to Nvidia and downloaded the Visual debugger that they have to see what physx is up to?
you will have to register to get it though.

Also download the SDK and look at how they do raycasting it will give a clue on how to make it work.

Dark Physics makes any hot drink go cold.
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 10th Mar 2011 01:26
Oh, disapointingly, Dark Physics raycasting does not work. It doesn't properly always raycast correctly and also can not return the first object hit, but the one with the lowest object #. It's very disapointing as I had to use sparky's for raycasting, which is great, but MUCH slower.

swis
Ninja_Je5us
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 10th Mar 2011 15:44
ok, thanks for the help guys.

A little disappointed by this tbh, but Dark Physics is a great program overall in my opinion.

Ive downloaded all I need for sparky's collision and am looking at the help files. I just need to understand how to do one thing I think, that is how to translate the end point of the ray depending on the direction in which the plane is facing.

here's my understanding of how I would use the code, (excluding the values I am enquiring about):



Any help would be appreciated.

Regards
Admiral MH
13
Years of Service
User Offline
Joined: 10th Feb 2011
Location: TX, USA
Posted: 10th Mar 2011 18:25 Edited at: 10th Mar 2011 18:27
Quote: "Oh, disapointingly, Dark Physics raycasting does not work. It doesn't properly always raycast correctly and also can not return the first object hit, but the one with the lowest object #. It's very disapointing as I had to use sparky's for raycasting, which is great, but MUCH slower."


Are you sure? I have not used raycasting that much, but it works for me. At least I have not had any problems returning the lowest object number.

Ninja_Je5us,

Here is the raycasting tutorial that comes with dark physics.



And here is how to raycast to the object angle.



Hope this helps.
Ninja_Je5us
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 10th Mar 2011 22:38
Thank you.

I have come up with a very simple solution, which involves a sphere of 0.1 radius being placed 500 steps in front of the planes position that is updated every frame.

I know this is not the best in terms of memory management but this is a very simple solution for a university project.

Is there any initialization that is needed for sparky's collision to work, in the same way the AIStart and PhyStart must be called?

and does SC_setupObject need to be called for every object that I want the ray to be able to collide with?
Admiral MH
13
Years of Service
User Offline
Joined: 10th Feb 2011
Location: TX, USA
Posted: 15th Mar 2011 18:16
Quote: "Is there any initialization that is needed for sparky's collision to work, in the same way the AIStart and PhyStart must be called?"


No there is not.

Quote: "and does SC_setupObject need to be called for every object that I want the ray to be able to collide with? "


Yes it has to be called for every object.

Login to post a reply

Server time is: 2024-11-24 13:53:52
Your offset time is: 2024-11-24 13:53:52