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.

Newcomers DBPro Corner / Sparky Collision V2 Raycasting Problem

Author
Message
vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 22nd Jul 2007 01:38
Hi guys, I've been trying to keep myself from posting to save everyone the trouble of answering loads of questions. So I've researched every problem I've had thoroughly before I ended up posting a thread.

This problem has been bugging me for a couple of days now so here goes. I'm currently working out shooting via raycasting for my player character. With Sparky's Collision I raycast from the character's firespot(gun) limb to a sphere 1000 units in front of that limb. This is the code I use.



For some reason the raycast is never returned true. I have had positive results only when actually specifying the raycast parameters as numbers rather than variables. My final conclusion is that the object/limb position return expressions do not work for raycasting, but it's more likely the case that I'm doing it wrong.

After extensive testing I am positive that this bit of code is wrong. But if it ends up to be a bug then I'll have to switch to the dark physics raycasting which in my opinion is in need of upgrading a lot.

Thanks in advanced for any answers, I hope I've provided enough information for everyone.


vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 22nd Jul 2007 13:05
Does anyone think dark physics may be a better alternative? I didn't find it very good for raycasting but thats what I use for the rest of my physics.


vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 24th Jul 2007 12:55
Anyone?


Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 25th Jul 2007 09:00
I'm not a Sparky's expert, but if the target sphere is object 88, what you're showing looks alright. Can you post more (or all) of the code you're working with?

- Jane
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Jul 2007 21:42
I saw a bug in DarkBasic where immediately after ROTATING the LIMB object - the LIMB POSITION was wrong for ONE call. Because I was using the value for a camera - I got a HOPPY CAM! WHILE TURNING LIMB - SNagging position, and setting camera - it was Altitude ZERO, when I stopped turning the limbed - it snapped to correct position....

I think your bullet is sliding across the ground!

Know way too many languages - Master of none
vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 26th Jul 2007 00:35
@ Jane - Thanks for answering



@Jason - Strange bug, but I don't think the raycast is sliding along the ground, the destination object is off the ground. Thanks anyway


Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 26th Jul 2007 01:32 Edited at: 26th Jul 2007 01:40
This should get you closer. I had to fill in some blanks and make some assumptions.



Try this and let us know how it works for you, or if you need anything else.

- Jane
vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 26th Jul 2007 02:51 Edited at: 26th Jul 2007 02:51
Thank you so much Jane, after editing the code a little I managed to get it to work perfectly to my needs.

I think I found the main problem with my original code, I originally glued the raycast destination object to the limb and then moved it. I have a feeling that it still thinks it's position is still at the limb whatever way or amount you move it, only a gut feeling though.

Thanks again Jane.


Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 26th Jul 2007 05:43
You're welcome. Glad to help.

- Jane

Login to post a reply

Server time is: 2024-11-26 12:43:06
Your offset time is: 2024-11-26 12:43:06