Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,405 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Jumping screws up collision #391340
01/10/12 23:08
01/10/12 23:08
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
I have a simple problem in my game at the moment.

When there's a doorway or a vent in my game, jumping at the wall above it results in the player moving through the wall once he has landed. I want to prevent this from happening. I made the player automatically crouch if this happened, but it gets in the way of other things, and is a rather rough fix.


NOTE: This image isn't completely accurate. The open space below has to be a bit bigger. What's shown above wouldn't actually result in the player moving through the wall.

Anything I can do to prevent this?

Re: Jumping screws up collision [Re: Valdsator] #391349
01/11/12 02:16
01/11/12 02:16
Joined: Dec 2009
Posts: 256
USA , NY
msmith2468 Offline
Member
msmith2468  Offline
Member

Joined: Dec 2009
Posts: 256
USA , NY
well how do you have it set up? are you using c_move? do you have USE_BOX set with a FAT or NARROW haul? I guess i don't really have enough information to help you. It appears from your drawing that the majority of you players body is going through a wall which means that your collisions box must be smaller then the player. did you use c_updatehull?

Here is a link to Game Studios Collision Engine details. http://www.conitec.net/beta/collision.htm


Mikes Wicked Games

www.mikeswickedgames.com
Re: Jumping screws up collision [Re: msmith2468] #391351
01/11/12 03:39
01/11/12 03:39
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Yes, I'm using c_move. I have the eflags FAT and NARROW set so I can change the collision box. Increasing the width and length of it doesn't seem to help, since once the player gets inside a block, nothing stops him. Collision with that block doesn't work until he gets out himself. No, I did not use c_updatehull, I manually set the max_x and min_x.

The red oval in my drawing is representing the collision ellipsoid of the player, and I have it set to be as big as the player model, except for the bottom, which is a bit shorter than the actual model. Making it the proper length doesn't fix the issue, though.

max_x is 8, 8, 45
min_x is -8, 8, -20

I think one thing causing the issue is the fact that the collision box is an ellipsoid. Since there's an opening, some of the ellipsoid is able to go through before colliding with the upper wall. Of course, this isn't the main reason, because I can do this without jumping, which simply results in the player getting slightly closer, and gliding horizontally getting all jittery.

Re: Jumping screws up collision [Re: Valdsator] #391419
01/11/12 21:46
01/11/12 21:46
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
a few things come to mind...

-Do you use c_move only for moving (forward,back,left,right), or do you also use c_move for the gravity?
-Do you use glide?
-How have you set max_x and min_x? Do you also use max/min_y and max/min_z?
-Have you tried using c_setminmax(me); instead of manually setting the collision hull size?
-If you character can also rotates... Do you just change the angles directly, or do you use c_rotate?

Not much more people can do for you though, if you don't post your movement code...


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Jumping screws up collision [Re: Carlos3DGS] #391430
01/11/12 23:37
01/11/12 23:37
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
I use c_move for gravity, yes.
I use GLIDE on this c_move.
I set max_x and min_x via vec_set.
Code:
vec_set(my.max_x,vector(8,8,45));
vec_set(my.min_x,vector(-8,-8,-20));


The reason for the bottom being only 20, while the top is 45 is because I use a c_trace to check for the floor, allowing the player to walk up stairs and such. Setting the -20 to -45 doesn't solve the issue, and since the c_trace is shooting downward, I don't think that's causing the problem (I think I'll test this just in case).

I tried c_setminmax(me); just now, but that didn't solve it. That's also a bit inconvenient due to the reason stated above.
The character rotates using my.pan -= mickey.x; I just tried using c_rotate, but that didn't change anything.

Re: Jumping screws up collision [Re: Valdsator] #391435
01/12/12 02:19
01/12/12 02:19
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
To my understanding it seems you are doing things right (at least in those cases that came to mind when I read your problem).

A few other thigs came to mind:
-Do you ever modify the x/y/z or pan/tilt/roll directly in another part of your code? (outside of the c_move/c_rotate functions)
-Are you animating your model? If so, are you using the POLYGON flag for the entity? Try to see what happens withought POLYGON.

On a different aproach to your problem also consider the following:
-the problem might not be in your code, it might be in the model you are using.
-Open the model in med. Are the feet at the axsis origin? Or is the waist around the axsis origin?
-Open your model in med, Object menu -> Transform Global -> Center Model, then save the model and test it again in your script (make a backup copy of the model first).
-include "default.c" in your main script. Run the code and press "F11" two times. Repeat the process that is giving you problems while you observe how the collision box behaves.

Searching for other possible causes... The problem might not be in your script nor in the character model, mabe it is the object you are colliding with.
-Is the object you are colliding with a WED block or another model?
-If it is a model... Is the origin at the center of the model? (you can check this in MED)
-Try to use c_setminmax(object); for the object you are colliding with.
-include default.c in your main script, run the game and press F11 twice, but this time look at the collision box of the object you are colliding with.


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Jumping screws up collision [Re: Carlos3DGS] #391447
01/12/12 10:17
01/12/12 10:17
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
How fast your player moves?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Jumping screws up collision [Re: 3run] #391484
01/13/12 02:56
01/13/12 02:56
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
30 * time_step is the top speed, but I don't think that's the problem.

I just made a new project with the same level and player model, same horizontal movement code, but a simple jump system, and now the issue is gone. Also, when the player glides against the vent, the reaction isn't so jittery. I have other code in the player of course, so I really don't know what's causing this problem. I'm going to do more tests and see if I can fix it.

EDIT: Ok, I replaced my old vertical movement code with the simple jump code and the issue has disappeared. I guess I'll go and try changing certain lines to see what specific code is causing the problem, and see if I can change it.

EDIT 2: Alright, so apparently it's the code that allows the player to go up slopes and stairs easily. More specifically, it's the code that snaps the player to the ground/slope (using my.z = ) so it's a smooth climb up or down. I guess I just need to find a different way to accomplish this.

Thanks to everyone who helped! laugh

Last edited by Valdsator; 01/13/12 03:12.
Re: Jumping screws up collision [Re: Carlos3DGS] #391505
01/13/12 13:56
01/13/12 13:56
Joined: Oct 2008
Posts: 513
Carlos3DGS Offline
User
Carlos3DGS  Offline
User

Joined: Oct 2008
Posts: 513
Originally Posted By: Carlos3DGS
-Do you ever modify the x/y/z or pan/tilt/roll directly in another part of your code? (outside of the c_move/c_rotate functions)


Ok a possible solution to your problem that will allow you to keep your code that calculates climbing up/down slopes smoothly...

Take the calculations from your "my.z = blablabla;" but instead of assigning it directly to my.z do something like this:

z_difference = my.z-(blablabla);
c_move(me,nullvector,vector(0,0,-z_difference),FLAGS);

That should give the same result you had before but it now considers collisions.
hope this helped!


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1
Re: Jumping screws up collision [Re: Carlos3DGS] #391594
01/14/12 01:15
01/14/12 01:15
Joined: Mar 2009
Posts: 186
V
Valdsator Offline OP
Member
Valdsator  Offline OP
Member
V

Joined: Mar 2009
Posts: 186
Hah, you're a genius. Never would have thought of that. Thanks! grin

Page 1 of 2 1 2

Gamestudio download | chip programmers | 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