Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Getting "stuck" where concave blocks intersect #176242
01/03/08 19:17
01/03/08 19:17
Joined: Mar 2002
Posts: 580
San Francisco
clone45 Offline OP
User
clone45  Offline OP
User

Joined: Mar 2002
Posts: 580
San Francisco
Hello,

I've tried my very best to ensure that this isn't my code at fault. I posted this issue to the "Starting with Gamestudio" forum before copying it here. I created a level that can be used to reproduce the bug, which I'll link to below. I've spent most of three days researching it. Hopefully it's a bug, or I'll be very embarrassed! :-) I'm using 7.06.

Here's what's up. When doing a c_move, my entity sometimes gets "stuck" where concave blocks intersect.

I'll reiterate my process from my original post:

Step 1: Create a block



Step 2: Copy the block so that I have a grid of 9 blocks



Step 3: Convert each block to a concave block



Step 4: Rise up one corner of one of the triangles



Step 5: Rise up more corners of the surrounding triangles to create a "bump"



Step 6: Attempt to walk on the bump. Get stuck often.



I seem to get stuck where the blocks meet. Here's a screen capture of one of the positions my entity has gotten stuck at:




When I say that the entity is getting stuck, I mean that attempting to move the entity using c_move doesn't work. I added logging to my script that prints out the entity's position and movement vectors. The code:

Code:


// Move the player
distance_moved = c_move(me, move_to_vector, nullvector, GLIDE|IGNORE_SPRITES|IGNORE_PASSABLE);

if (key_z)
{
diag_var("\nx: %6.3f",my.x);
diag_var("\ny: %6.3f",my.y);
diag_var("\nz: %6.3f",my.z);
diag_var("\ndistance to ground: %6.3f",distance_to_ground);

diag_var("\nmove to x: %6.3f",move_to_vector.x);
diag_var("\nmove to y: %6.3f",move_to_vector.y);
diag_var("\nmove to z: %6.3f",move_to_vector.z);
diag_var("\ndistance moved: %6.3f", distance_moved);
diag_var("\nin solid: %6.3f",in_solid);
}



And here is 2 frames of the output:

x: -512.035
y: 236.587
z: 136.929
distance to ground: 0.000
move to x: 2.971
move to y: 0.000
move to z: 0.000
distance moved: 0.000
in solid: 0.000

// .. next loop
x: -512.035
y: 236.587
z: 136.929
distance to ground: 0.000
move to x: 2.979
move to y: 0.000
move to z: 0.000
distance moved: 0.000

Notice that I'm attempting to move the entity forward 2.979 quants. c_move isn't moving the entity. However, it's also not reporting that I'm stuck in a block. During these frames, I'm not trying to move in the z-direction. distance_moved is set to 0.

I took my project and stripped it down to the bare essentials for testing. I was able to create a project where you can easily recreate the issue. You can download my example project here. In the demo, if you hit 'p', you'll be positioned to a trouble spot that's easy to get stuck on. Try hitting 'p', then a or d to strafe left or right. You should immediately find yourself stuck.

Here's my movement code:

Code:

action move_me()
{

VECTOR move_to_vector; // Holds the relative x,y,z values that are added to the character's position
var distance_to_ground;
var distance_moved;

move_to_vector.x = 0;
move_to_vector.y = 0;
move_to_vector.z = 0;

wait(1);
c_setminmax(me);
vec_set(my.min_x,vector(-8,-8,-20));
vec_set(my.max_x,vector(8,8,20));

while(1)
{

accelerate(move_to_vector.y, (key_d * strafe_speed * time_step * -1), 0.8); // strafe right
accelerate(move_to_vector.y, (key_a * strafe_speed * time_step), 0.8); // strafe left
accelerate(move_to_vector.x, (key_w * run_speed * time_step), 0.8); // go forward
accelerate(move_to_vector.x, (key_s * run_speed * time_step * -1), 0.8); // go back

distance_to_ground = c_trace(my.x, vector(my.x,my.y,my.z - 500), IGNORE_ME|IGNORE_PASSENTS|IGNORE_PASSABLE|IGNORE_SPRITES|USE_BOX);
move_to_vector.z = -1 * distance_to_ground;

distance_moved = c_move(me, move_to_vector, nullvector, GLIDE|IGNORE_SPRITES|IGNORE_PASSABLE);

wait(1);
}
}



I've tried compiling my level with Don't snap verticies on and off. I've also tried Merge across leaves. Neither makes a difference.

Thanks!
- Bret

Re: Getting "stuck" where concave blocks intersect [Re: clone45] #176243
01/04/08 14:52
01/04/08 14:52
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Thanks for the info - can you send that test project to the support? I'll look into this.

Re: Getting "stuck" where concave blocks intersect [Re: jcl] #176244
01/05/08 01:45
01/05/08 01:45
Joined: Mar 2002
Posts: 580
San Francisco
clone45 Offline OP
User
clone45  Offline OP
User

Joined: Mar 2002
Posts: 580
San Francisco
Thanks jcl,

Here's a link to the test level:

http://www.indiegamejobs.com/temp/mesh_bug.zip

If you'd prefer that I email it to support, I'd be happy to if you'd supply me with the email.

Thanks again!
- Bret

Re: Getting "stuck" where concave blocks intersect [Re: clone45] #176245
01/05/08 10:55
01/05/08 10:55
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Thanks, I got it and will look into it next week.

Re: Getting "stuck" where concave blocks intersect [Re: jcl] #176246
01/11/08 07:25
01/11/08 07:25
Joined: Mar 2002
Posts: 580
San Francisco
clone45 Offline OP
User
clone45  Offline OP
User

Joined: Mar 2002
Posts: 580
San Francisco
Hi JCL,

Just a friendly reminder that I would love it if you could review this collision issue!

Thanks,
- Bret

Re: Getting "stuck" where concave blocks intersect [Re: clone45] #176247
01/11/08 08:36
01/11/08 08:36
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
I'll definitely look into it and will either provide a work around or a solution for the problem. It just didn't work this week so far and I'll be away the next 7 days, but I'll take care of it after my return - promise.

Re: Getting "stuck" where concave blocks intersect [Re: jcl] #176248
01/11/08 22:39
01/11/08 22:39
Joined: Mar 2002
Posts: 580
San Francisco
clone45 Offline OP
User
clone45  Offline OP
User

Joined: Mar 2002
Posts: 580
San Francisco
Fantastic! If I don't hear from you within about 10 days, I'll post another reminder. If there's anything that I can do to assist you in troubleshooting the problem, just ask!

Re: Getting "stuck" where concave blocks intersect [Re: clone45] #176249
01/13/08 13:10
01/13/08 13:10
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
Playing you demo in Lite-C, I cound only find one little part, where the entity got stuck.
(not really stuck, as it could move back), normally it moves fine.

Your problem is not really related to the BSP architecture/collision hull , but rather to a bad movement code.
You let your entity slide on te ground.
If you would walk in daily life like that - sliding with your feet tied to the ground -
you would trip over every edge in the carpet already.

You should write a better movement code:

First: lift a leg up. (move the entity up a certain amount)
then move the body forward (move into heading direction without movement in hight (z))
then take the leg down (move down the amount you moved up + the acceleration by gravity)

this way little edges on the ground cant make the entity get stuck anymore.

In the showcase I have a demo with an advanced movment code that is
not hard to transfer to Lite-C.

Re: Getting "stuck" where concave blocks intersect [Re: Damocles] #176250
01/13/08 17:36
01/13/08 17:36
Joined: Mar 2002
Posts: 580
San Francisco
clone45 Offline OP
User
clone45  Offline OP
User

Joined: Mar 2002
Posts: 580
San Francisco
Hi Damocles,

Brilliant! At first I didn't think that your solution would be of any help, but the idea of keeping the bounding box above the level geometry solved the problem of getting stuck.

Here's a screen capture of where my new bounding box is positioned:



@jcl: My problem is solved! I'm still curious as to why the c_move didn't work, but I'm moving on. Feel free to ignore my bug submission if you don't have time to work on it.

Re: Getting "stuck" where concave blocks intersect [Re: clone45] #176251
01/13/08 22:22
01/13/08 22:22
Joined: Jan 2003
Posts: 4,305
Damocles Offline
Expert
Damocles  Offline
Expert

Joined: Jan 2003
Posts: 4,305
you are welcome

Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1