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.

AppGameKit Classic Chat / RayCast Interferance

Author
Message
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 17th Oct 2017 18:03
Does anyone know of any object (probably invisible) that could could cause a RayCast to be interrupted? In my application I have tried everything possible with RayCasting; with or without physics, with or without sprite shape Boxes, categories, groups, etc. Nevertheless, there are times when a RayCast detects a collision when it shouldn't.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Oct 2017 18:30 Edited at: 17th Oct 2017 18:37
this should output the obj id
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.9.3) Radeon R7 265 : Mac mini OS High Sierra (10.13)
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 20th Oct 2017 00:30
tried this to output the obj ID, and it always outputs 0 no matter which object interrupts the ray cast. I don't get it.


Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 20th Oct 2017 01:34
you have an example for us?
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.9.3) Radeon R7 265 : Mac mini OS High Sierra (10.13)
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 20th Oct 2017 01:34
I have some fun sometimes with the raycasting, thinking there's something wrong perhaps.

It always ends up with something stupid I was doing

You are talking about 2d or 3d? You mention sprite shapes, but then mention outputting Obj IDs?

First thing to check is that you aren't hitting the object you are casting from.

greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 20th Oct 2017 12:39


The problem seems to be the same whether its 2D or 3D. The documentation says that the shape a ray cast originates from is not included in the hit results.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 20th Oct 2017 15:49 Edited at: 20th Oct 2017 15:50
see SetPhysicsWall... Command and set it to 0, i think the ray hit the border because everything have category 1 by default.
or use Block=2
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.9.3) Radeon R7 265 : Mac mini OS High Sierra (10.13)
greycheek
8
Years of Service
User Offline
Joined: 13th Mar 2016
Location:
Posted: 20th Oct 2017 17:42
I don't see how Block = 2 makes a difference, but that seems to have solved the problem. Thanks, Markus
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 20th Oct 2017 17:58 Edited at: 20th Oct 2017 17:59
ok.
the screen borders are walls by default, so a longer ray will hit them.
if they are category 1 and you will test only category 2 they will be invisible for the ray.
other option is to disable the walls.
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.9.3) Radeon R7 265 : Mac mini OS High Sierra (10.13)

Login to post a reply

Server time is: 2024-11-24 08:20:58
Your offset time is: 2024-11-24 08:20:58