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.

DarkBASIC Professional Discussion / sparkys fall through level

Author
Message
Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 12th Nov 2011 07:12
Here's the problem:

My collision works awesome, except for when a bunch of ai entities with collision get close to the player. Every once in a great while it pushes the player down below the level.

Anyone have a idea on how to fix this?

Thanks in advance, mych

The fastfood zombie killer
enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 12th Nov 2011 12:06
Might be caused by using SphereCasting. If the player sphere goes below one of the enemy spheres it might be pushed down, because it is sliding under another sphere.

Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 12th Nov 2011 20:41
hmm, that certainly sounds like a possibility. I've been using the sphere slide command for the player movement

The fastfood zombie killer
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 12th Nov 2011 21:53
The easiest thing is probably just to ignore the y part of the sliding collision when colliding against enemies. Or ignore it if it's below the player's current y position if you want to be able to walk over enemies.
Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 13th Nov 2011 04:21
How do you tailor it to only detect the y part of the collision when colliding with a zombie and not the level?

The fastfood zombie killer
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 13th Nov 2011 19:37
Hi,


Make sure you're storing the old positions of the player. This way, the command SC_SphereCast(oldx,oldy,oldz,x,y,z,radius,exclude) won't ever return values that let the player fall through the level:



TheComet

Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 14th Nov 2011 00:58
I'll go ahead and check that right now, but I thought I'd also put up a work around that I found. The error only happened when there was to many entities around the player, so I decided to limit the max collisions, and so far it's working

The fastfood zombie killer
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 15th Nov 2011 22:09
Glad you've sorted something out for this. I find these sort of problems insanely frustrating.

Quote: "How do you tailor it to only detect the y part of the collision when colliding with a zombie and not the level?"


What I meant is do the sphere cast a normal but only change the x and z position for the sliding and keep the y position the same when colliding with zombies.

Using The Comet's code as an example, the collision detection would change to this:



You may or may not want to change the gravity when hitting zombies.

The other thing you could try is do the collision with the zombies first and then do the collision with the map. This could have the effect of pushing the player closer to a zombie rather than through the map, wouldn't look as bad. I say "This could have the effect... " as I don't know how you're doing the collision so I couldn't say for sure and I'm also making the assumption that it's going to be easy to seperate out the collision with the zombies from the collision with the map.
Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 16th Nov 2011 07:46
That actually sounds like a perfectly good solution with me looking to deep for the answer when the answer was right in front of my face. Thanks for the advice.

The fastfood zombie killer
Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 17th Dec 2011 01:26
I finally got it working. It didn't quite work the way we though up, because the level and ai were in the same collision group I was unable to decide which would be chosen first. What I ended up doing was separating them into two groups, then when I did the collision check for the ai I didn't reposition on the Y axis. Works perfectly now!!!

The fastfood zombie killer

Login to post a reply

Server time is: 2026-07-09 21:20:03
Your offset time is: 2026-07-09 21:20:03