Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Nymphodora, AndrewAMD, TipmyPip, Quad, Imhotep), 847 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Non-Passable Bounding Box Needed #468864
10/24/17 02:26
10/24/17 02:26
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
I am trying to make the bounding box (manually set collision hull) surrounding an NPC to not allow the player to enter the bounding box. I successfully created a bounding box, as I can tell by pressing the F11 key twice and seeing it. However, the player is continually able to pass into the NPC's bounding box when I do not want it to.

I thought I knew how to do this in the past, but it has been awhile since I have done it, and I forgot. I thought I did everything I needed to do to make the bounding box non-passable, as follows:

Code:
function playerAdvance()
{
   c_move(me, move_vec, vector(0, 0, my.GRAVITY_VAR), 
      USE_POLYGON | IGNORE_PASSABLE | IGNORE_PUSH | GLIDE);
}

action player_function()
{
   ...
	
   player = me;
   my.push = 10;
	
   ...
   
   my.eflags |= FAT | NARROW; 

   ...
   
   c_setminmax(me);  
   set(my, POLYGON);
  
   ...

   while (player_health > 0)
   {
      ...
			
      playerAdvance(); 

      ...

      wait(1);
   }

   ...
}

action villain_action()
{
   ...
	
   my.eflags |= FAT | NARROW;
		
   ...

   villain = me;
	
   ...
	
   my.push = 10;
   set(my, POLYGON);

   ...

   while (my.status != villain_dead)
   {
      ...

      wait(1);
   }

   ...
}	

void createVillain()
{
   villain = ent_create("villain.mdl",
      vector(-64,146,-111), villain_action );
   
   ...
	
   c_setminmax(villain);

   // set bounding box to individual values
   vec_set(villain.min_x,vector(30,20,80)); 
   vec_set(villain.max_x,vector(-20,-20,0));
}

function newGameButton()
{
   ...

   level_load ("gameWorld.wmb");

   ...
   
   hero = ent_create ( "player.mdl", vector(8,-606,-111),
      player_function ); 

   ...
}


I tried setting c_setminmax() before manually creating the bounding box. I also set the push value of the NPC to the same push value as the player. The model of the NPC itself is creating collision (Un-passable), but not the bounding box surrounding the NPC. I tried getting rid of c_setminmax(), but the same thing happens.

Any advice would be greatly appreciated in helping me to make the collision hull un-passable. Thank you.

Last edited by Ruben; 10/24/17 02:30.
Re: Non-Passable Bounding Box Needed [Re: Ruben] #468865
10/24/17 05:15
10/24/17 05:15
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You cannot let the entity collide with another entity's bounding box (which is an ellipsoid, not a box) when you set POLYGON on the target or USE_POLYGON in c_move.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Non-Passable Bounding Box Needed [Re: Superku] #468879
10/25/17 02:23
10/25/17 02:23
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
I commented out every instance of:

Code:
set(my, POLYGON);



...in the previous code. I also changed the c_move function to this:

Code:
c_move(me, move_vec, vector(0, 0, my.GRAVITY_VAR), IGNORE_PASSABLE | 
   IGNORE_PUSH | GLIDE);



Now what happens is that the player is still passing through the bounding box of the villain, and also passing through the villain's body itself. Before, collision would at least occur with the body of the villain itself, even though the bounding box was not offering collision. Now neither the villain's body nor the bounding box are causing collision.

Last edited by Ruben; 10/25/17 02:25.
Re: Non-Passable Bounding Box Needed [Re: Ruben] #468880
10/25/17 02:32
10/25/17 02:32
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
The push values do not seem to be working. I set the player push value to 1, and the villain's push value to 100, and the player is still able to pass through the villain's bounding box.

Re: Non-Passable Bounding Box Needed [Re: Ruben] #468886
10/25/17 17:29
10/25/17 17:29
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Am I missing something in making the bounding box unpassable? I thought I remembered this being a lot easier to do, back when I knew how to do it.

Re: Non-Passable Bounding Box Needed [Re: Ruben] #468887
10/25/17 18:57
10/25/17 18:57
Joined: Jul 2014
Posts: 72
D
DriftWood Offline
Junior Member
DriftWood  Offline
Junior Member
D

Joined: Jul 2014
Posts: 72
Reading...
http://www.conitec.net/beta/ac_move.htm
http://www.conitec.net/beta/c_ignore.htm
http://www.conitec.net/beta/collision.htm
http://www.conitec.net/beta/aentity-fat.htm

Give this a try... Also, makes sure you don't have a c_ignore setup wrong somewhere....
Code:
function playerAdvance()
{
   c_move(me, move_vec, vector(0, 0, my.GRAVITY_VAR), 
      | IGNORE_PASSABLE | GLIDE);
// testing beeping means contact
    if (HIT_TARGET)
{
    if (you == villain)
     beep();
}

}

action player_function()
{
   ...
	
   player = me;
  
	
   ...
   
   my.eflags |= FAT | NARROW; 
//  c_setminmax(me);   // set my bounding box to my real size
// Don't need both, use one or the other

   ...
   
  
   ...

   while (player_health > 0)
   {
      ...
			
      playerAdvance(); 

      ...

      wait(1);
   }

   ...
}

action villain_action()
{

   villain = me;
	wait(1);
   ...

   ...
	
   my.eflags |= FAT | NARROW;
//// ARE The Values correct
	 // set bounding box to individual values
   vec_set(villain.min_x,vector(30,20,80)); 
   vec_set(villain.max_x,vector(-20,-20,0));	
   ...

	
  

   ...

   while (my.status != villain_dead)
   {
      ...

      wait(1);
   }

   ...
}

void createVillain()
{
   villain = ent_create("villain.mdl",
      vector(-64,146,-111), villain_action );
   
   ...
	
  // Don't set a value on the object, outside the object. 
  // Villains action should control the BBOX - just good object-based thinking
  
}



Final notes. BBox's should penetrate each other a bit. As Super notes it's not really a box.

Edit - The example in http://www.conitec.net/beta/aentity-fat.htm shows the negative numbers under min_x not max_x. Is this a possible cause for your BBox not working
Code:
my.eflags |= FAT | NARROW;
//// ARE The Values correct
	 // set bounding box to individual values
   vec_set(villain.min_x,vector(-20,-20,0)); 
   vec_set(villain.max_x,vector(30,20,80));


http://www.conitec.net/beta/aentity-min_x.htm

Last edited by DriftWood; 10/26/17 03:10.
Re: Non-Passable Bounding Box Needed [Re: DriftWood] #468957
10/30/17 00:44
10/30/17 00:44
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Thank you DriftWood! Your solution worked! The wait(1) after the me = villain code seemed to be the finishing touch, and it appears you were right about the negative values being in the wrong place for the vec_set min/max. Thanks again.

Last edited by Ruben; 10/30/17 00:45.
Re: Non-Passable Bounding Box Needed [Re: Ruben] #469056
11/04/17 19:47
11/04/17 19:47
Joined: Jul 2014
Posts: 72
D
DriftWood Offline
Junior Member
DriftWood  Offline
Junior Member
D

Joined: Jul 2014
Posts: 72
You're Welcome

Last edited by DriftWood; 11/04/17 20:54.

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