Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 552 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: How to confirm collision with level blocks? [Re: Superku] #444017
07/29/14 00:14
07/29/14 00:14
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
Using the AUM 4 snippets that Dlively posted, I've written this code
Code:
action RightMarkerAction()
{
	set(my, PASSABLE);
	my.blue = 100;
	my.ambient = 100;
	my.lightrange = 200;
	while(1)
	{
		FrontRightPos.x = your.x + (50 * cos(your.pan)) + (50 * sin(your.pan));
	    FrontRightPos.y = your.y + (50 * sin(your.pan)) - (50 * cos(your.pan));
	    FrontRightPos.z = your.z;
		vec_set(my.x,FrontRightPos);
		wait(1);
	}
}

action LeftMarkerAction()
{
	set(my, PASSABLE);
	my.red = 100;
	my.ambient = 100;
	my.lightrange = 200;
	while(1)
	{
		FrontLeftPos.x = your.x + (50 * cos(your.pan)) - (50 * sin(your.pan));
	    FrontLeftPos.y = your.y + (50 * sin(your.pan)) + (50 * cos(your.pan));
	    FrontLeftPos.z = your.z;
		vec_set(my.x,FrontLeftPos);
		wait(1);
	}
}

function CreateMarker()
{
	FrontRightPos.x = my.x + (50 * cos(my.pan)) + (50 * sin(my.pan));
	FrontRightPos.y = my.y + (50 * sin(my.pan)) - (50 * cos(my.pan));
	FrontRightPos.z = my.z;
	ent_create("box.mdl", FrontRightPos, RightMarkerAction);
	
	FrontLeftPos.x = my.x + (50 * cos(my.pan)) - (50 * sin(my.pan));
	FrontLeftPos.y = my.y + (50 * sin(my.pan)) + (50 * cos(my.pan));
	FrontLeftPos.z = my.z;
	ent_create("box.mdl", FrontLeftPos, LeftMarkerAction);
	wait(1);
}



Now I have two transparent boxes floating slightly in front of my entity, 1 to the left and 1 to the right. They visually represent the vector positions that will check whether my entity has bumped into a wall. I don't know how exactly to perform that check. The AUM used C-SCript and the check was done using
Code:
BooleanVar = content(VectorToBeChecked);
if(BooleanVar == content_solid) 
{ ObstcaleInThatDirection = 1;}


What's the lite-c equivalent of content() and content_solid?

Re: How to confirm collision with level blocks? [Re: tolu619] #444050
07/29/14 18:26
07/29/14 18:26
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
While waiting for a response, I found "in_solid", so I tried using it to detect whether my marker boxes were inside walls. When it didn't work, I copied and pasted the example from the manual and replaced my player's action code with it. I still don't get any response to show that it has detected a wall when my player touches one.
Code:
while(1)
	{
		 c_move(me,vector(time_step*10,0,0), nullvector,0);
 	  if (in_solid)		// Is Entity inside a block?
 	  {
 	    error("Solid!");
 	  }
    if (in_passable) // Is Entity inside a passable block?
 	  {
 	    error("Passable!");
 	  }
 	  if (on_passable) // Is Entity on a passable block?
 	  {
 	    error("On water!");
 	  }
		wait(1);
	}


Re: How to confirm collision with level blocks? [Re: tolu619] #444053
07/29/14 19:14
07/29/14 19:14
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Stuff like (c_?)content and in_solid and the like sadly is outdated and does not work with the more or less modern meshes generated by the Map Compiler.

Just do a c_trace from the player position to those of the floating boxes and check its result values for collision.


"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: How to confirm collision with level blocks? [Re: Superku] #444071
07/30/14 00:35
07/30/14 00:35
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
I've bypassed the floating boxes now and I'm performing a trace directly from my player to the vectors where the boxes would have been located.
Code:
while(1)
{
.........
FrontRightPos.x = my.x + (50 * cos(my.pan)) + (50 * sin(my.pan));
	                FrontRightPos.y = my.y + (50 * sin(my.pan)) - (50 * cos(my.pan));
	                FrontRightPos.z = my.z;
	
	                FrontLeftPos.x = my.x + (50 * cos(my.pan)) - (50 * sin(my.pan));
	                FrontLeftPos.y = my.y + (50 * sin(my.pan)) + (50 * cos(my.pan));
	                FrontLeftPos.z = my.z;

if(c_trace(me, FrontRightPos, IGNORE_ME | IGNORE_MODELS | IGNORE_SPRITES | IGNORE_CONTENT)>0)
	   	            RightWall = 1;

	   	            
	   	            if(c_trace(me, FrontLeftPos, IGNORE_ME | IGNORE_MODELS | IGNORE_SPRITES | IGNORE_CONTENT)>0)
	   	            LeftWall = 1;
	   	            
	   	            if(RightWall == 1 && LeftWall == 1)
	   	            {
	   	            	dash = 0; my.animation = 0; FrontWall = 1; WallRunning = 1;
	   	            	printf("Front Wall!"); 
	   	            }
	   	            else if(LeftWall == 1 && RightWall == 0)
	   	            {
	   	            	dash = 0; my.animation = 0; WallRunning = 1;
	                	printf("Left Wall!");             	
   	            	}
   	            	else if(RightWall == 1 && LeftWall == 0)
   	            	{
   	            		dash = 0; my.animation = 0; WallRunning = 1;
	                	printf("Right wall!"); 
   	            	}
.............
}


Both booleans "Leftwall" and "Rightwall" are set to 1 the moment I run the function that checks, regardless of how far away the player is from a wall. I tried using HIT_TARGET and got the same results.
Code:
c_trace(me, FrontRightPos, IGNORE_ME | IGNORE_MODELS | IGNORE_SPRITES | IGNORE_CONTENT);
	   	            if(HIT_TARGET)
	   	            {
	   	            	RightWall = 1;
   	            	}


These first two options ALWAYS respond as if a wall was detected, even if it wasn't. If I use hit.nx to check, I'll never get a positive response, wall or not.

Re: How to confirm collision with level blocks? [Re: tolu619] #444073
07/30/14 00:55
07/30/14 00:55
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Try this:
Code:
result = c_trace(my.x, FrontRightPos.x, IGNORE_ME | IGNORE_MODELS | IGNORE_SPRITES | IGNORE_CONTENT);
	   	            if(result > 0)
	   	            {
	   	            	RightWall = 1;
   	            	}



A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: How to confirm collision with level blocks? [Re: DLively] #444076
07/30/14 01:19
07/30/14 01:19
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
Originally Posted By: DLively
Try this:
Code:
result = c_trace(my.x, FrontRightPos.x, IGNORE_ME | IGNORE_MODELS | IGNORE_SPRITES | IGNORE_CONTENT);
	   	            if(result > 0)
	   	            {
	   	            	RightWall = 1;
   	            	}


Didn't work. I've tried trace_hit, hit.texname (pretty much everything that follows the dot after 'hit'), I've been going through the manual and trying everything for 2 hours now. Everything I've tried either always gives a positive result or always gives a negative result, regardless of my actual position relative to a wall.

Re: How to confirm collision with level blocks? [Re: tolu619] #444304
08/05/14 20:41
08/05/14 20:41
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
Hello? Guys, this issue is still unresolved!

Re: How to confirm collision with level blocks? [Re: tolu619] #444305
08/05/14 21:35
08/05/14 21:35
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Debug it then.
Check the you-pointer, create CUBE_MDLs at hit positions, draw values and so on.
You have to do it yourself, apparently.

Suggestion:
RightWall = trace_hit; // no if-case, just like that after the c_trace
vec_set(vRightWallTarget,target);
... same for left

then draw_line3d from player to those target vectors


"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: How to confirm collision with level blocks? [Re: Superku] #444310
08/06/14 06:26
08/06/14 06:26
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
what I mentioned code earlier features debugging by drawing lines of c-tracings as Superku mentioned. beside preventing to go deep into water.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: How to confirm collision with level blocks? [Re: sivan] #444316
08/06/14 09:02
08/06/14 09:02
Joined: Jun 2014
Posts: 97
Lagos, Nigeria
T
tolu619 Offline OP
Junior Member
tolu619  Offline OP
Junior Member
T

Joined: Jun 2014
Posts: 97
Lagos, Nigeria
Alright, thanks. I have exams coming up so I'm taking a break for about 6 weeks. I'll let you guys know how it goes when I get back to it. Here's a trailer for what I have so far http://t.co/uW1jRhnisN

Page 2 of 2 1 2

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

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