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 (TipmyPip, AndrewAMD, NewbieZorro), 16,055 guests, and 7 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
Help: Understanding c_move collision requirements #217043
07/21/08 01:30
07/21/08 01:30
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
I’m using the Lite-C Free version. Some collision detection fails. Based on the manual, I have to create a hollow block in order for c_move collision detection to works properly. So I created my game as below :-




Preparation in MED:

Stage (the red color): Consist of 5 blocks. 4 x walls and 1 x floor. Save into one .mdl

Big Room (the grey color): Consist of 6 blocks. Save into six .mdl

Invisible Stage Bounding (the teal color): Consist of 6 blocks. The bottom blocks touched the bottom of the stage. Save into six .mdl

Obstacle (the green color): A box saved into one .mdl

Obj1 (the yellow color): A sphere saved into one .mdl

Obj2 (the blue color): A sphere saved into one .mdl


Preparation in Lite-C (the code):

Stage: Call using ent_create( ). Set to PASSABLE.

Big Room: Call each block separately using ent_create( ).

Invisible Stage Bounding: Call each block separately using ent_create( ). Set to INVISIBLE.

Obstacle: Call using ent_create( ).

Obj1: Call using ent_create( ). Move using phent_addtorqueglobal( ).

Obj2:
Call using ent_create( ).
Move using c_move( …, GLIDE | IGNORE_PASSABLE ).
Set emask |= (ENABLE_ENTITY)
In the event function, on case EVENT_ENTITY, vec_to_angle(my.pan, bounce).


What happened?

Obj1 got no problem. It can collide with the Invisible Stage Bounding, Obj2 and the Obstacle.
Obj2 can collide with the Obstacle and Obj1 but CAN PENETRATE the Invisible Stage Bounding.


So where is my mistake?

FYI, I tried 2 version of the Big Room (the grey color). Both fail. The first one, each block overlaps each other. Which means, even the smallest entity can’t pass through them. The second version, I apart them a little bit. Which means, a very small entity can pass the gap but the Obj2 (the yellow color) still can’t make it since the gap is not too big.

Or is there anything to do with the sequence of entity loading?

Re: Help: Understanding c_move collision requirements [Re: Coisox] #217051
07/21/08 03:47
07/21/08 03:47
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
Another strange behavior:

Since Obj2 can collide with Obstacle, so I duplicate Obstacle into 4 new entities and scale to become wall. Place them along the stage end (my Invisible Stage Bounding still remain).

So I run the game, and yeah!!! Obj2 can bounce when reach the end of the Stage (thx to the new dummy walls derived from Obstacle). But then, I pan the Obj2 to 70 degree. Guess what? Obj2 can penetrate again!!

If I can't find the solution, I have to hard code the bounding myself like this:
Code:
if (Obj2.x > 800 ) Obj2.pan = 180;
if (Obj2.x < -800 ) Obj2.pan = 180;
if (Obj2.y > 800 ) Obj2.pan = 180;
if (Obj2.y < -800 ) Obj2.pan = 180;

But this method, how to handle if the angle of Obj2 isn't 90 degree? Like 70 degree... crazy

Re: Help: Understanding c_move collision requirements [Re: Coisox] #217053
07/21/08 03:52
07/21/08 03:52
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
BTW, what is BLOCK? What makes big ENTITY different from BLOCK? Because I try to implement event for EVENT_BLOCK and ENABLE_BLOCK for the emask but no good. How to declare ENTITY as BLOCK?

Re: Help: Understanding c_move collision requirements [Re: Coisox] #217059
07/21/08 04:53
07/21/08 04:53
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
Ok, at last. I figure out whats heppening. Its the default bounding box set by the engine is very small and cube shape. Using c_setminmax( ) solved the problem.


Just to share experience with newbie like me:

1. We must create a very big Hollow Box (in my diagram, its in grey color) to wrap the whole game/stage/level. A Hollow Box is 6 blocks of wall placed like a cube. I'm not sure whether you can use a cube and then flip the normal to be used as Hollow Box even the engine will render correctly.

2. If you don't create a Hollow Box, collision detection for physic entity is still good.

3. The Hollow Box must not be set c_setminmax( ). Otherwise, some c_move become stuck.

4. If you plan to create a dummy bounding box like me (in my diagram, its in teal color), always set to c_setminmax( ) after the entity creation. Otherwise, the engine will set a very small bounding box in cube shape. This is known as "hull" in the manual.

5. ALWAYS press F11 twice to solve collision detection problems. The blue wireframe represent the bounding that will be calculated by the engine. If you can't see the blue wireframe, it means no bounding box or the entity is misplace.

In my earlier experience, I thought, even some of the entities got no blue wireframe, the bounding box is still exist but maybe overlap each other. But I was wrong. No wireframe means no bounding!

Re: Help: Understanding c_move collision requirements [Re: Coisox] #234312
11/02/08 02:01
11/02/08 02:01
Joined: Apr 2005
Posts: 69
G
Goodberry Offline
Junior Member
Goodberry  Offline
Junior Member
G

Joined: Apr 2005
Posts: 69
Hey, you rock smile Very organized post and helpful. Thank you!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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