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 / Raycasting bug

Author
Message
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 10th Feb 2019 00:25
Ok, so I've been playing constantly and I think thre is DEFINETLY a raycasting bug in AGK.....unless there's a fundamental issue.

Specifically, on the X axis, and when casting against an object that has a very low angle of difference to the cast.

The attached video shows this perfectly....when I rotate around the Y axis, no issues what so ever. When I rotate the X axis to make the raycast go down (it's casting from object position to camera position, then placing the camera at the intersection point) it goes crazy when the angle is too steep/small. The number on the screen is the object number it is colliding with - you can see this jumps between 0 and the object every other frame.

This is the exact same problem I had with the vehicle physics, as it kept "missing" the ground when casting downwards....again, only every other frame. It's really odd....but I;ve had ZERO issues with it in any direction other than when the raycast is moving upward along an object.

Note the building is just a simple cube.

Paul, this is making 3D collision a nightmare to get fully working - can you PLEASE have a look? I suspect it's also the reason behind some of the physics tunneling.

blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Feb 2019 00:31 Edited at: 10th Feb 2019 00:33
My kart physics uses extensive downward raycasting and it doesn't seem to be a problem.
Is it possible to post a simple project using just boxes so i could have a look?

ps: when working with angles i found that i had to use -180 to 180 because when i used 0 to 360 it jiggered like that as it went from 360 to zero
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 10th Feb 2019 00:33
One quick update - I added code to check if there was a zero impact, to offset all the coords being checked by 5.5 and then do a second raycast.

Oddly, the second raycast ALWATS returns zero. So perhaps the result is coming back to AppGameKit quickly enough, and that's causing every other frame to pick it up? To check I forced the frame rate to 25 in mode 1....it made zero difference.
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 10th Feb 2019 00:34
Perhaps the difference is I'm not using the physics then....though technically this is casting UP actually, as the player is below the camera so it is casting from player to camera. Maybe that's the issue?

Turning off screenculling made no difference either.

Alas, my code is in the middle of a larger project, but I'll try to extract it into a smaller project.
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 10th Feb 2019 00:52
Oh and also, collision doesn;t work on animated objects - they just seem to cast a mesh based "cube" that you can't pass through....through I suspect this is normal?
Santman
7
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 10th Feb 2019 01:05
And just like that....something hit me.

So, the maximum camera distance I want from the player is 150000 units (in my game scale is large). So what I was doing was....moving the camera along the -Z axis by 150000 units, then checking the raycast. If it hit something, then move the camera to the point of impact.

HOWEVER.....if that impact came too close to the end of the raycast, it's alternativelt not being detected. So I increased the raycast distance to DOUBLE what I actually wanted to check, then redo the positioning and only take action if the collision distance is greater than the maximum I wanted to check.

Not sure if this then is a bug or not, however I think going by the video it's certainly odd, if not a bug.

Login to post a reply

Server time is: 2019-04-23 20:01:34
Your offset time is: 2019-04-23 20:01:34