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
check the height of a block #375185
06/24/11 03:59
06/24/11 03:59
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
is it possible to approach a block, and see if its height (from my players height, to the top of the block) is under a certain number?

I have some theories.. but they dont work...

basically I have this to start >>
Code:
///.. Checked to see if the player is infront of a block
if(trace_hit!=0){
	if(you==null){//you are a wall
		jump_obstacle=1;
	}
}



now since the block is not an entity, the 'you' pointer doesnt work..

so doing this:
Code:
///.. Checked to see if the player is infront of a block
if(trace_hit!=0){
	if(you==null){//you are a wall
		if(vec_dist(my.z, you.max_z)<25){jump_obstacle=1;}
	}
}



gives me an empty pointer error

any ideas? .. Please laugh

Edit: the reason why I would like this is because my player will check to see if the block infront of him is a valid block to jump up onto.. if its higher than 25, he shouldnt jump.. maybe this is some better info?

Last edited by DevoN; 06/24/11 16:52.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: check the height of a block [Re: DLively] #375309
06/24/11 21:05
06/24/11 21:05
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
I just wanted to bump this, so that it re-appears in the "Newest Posts" menu to the left of the forum, since its been edited.

Hope nobody minds laugh


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: check the height of a block [Re: DLively] #375313
06/24/11 21:13
06/24/11 21:13
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
You don`t can use "you.max_z" if the you pointer is NULL, that gives always a crash!

Use a var to become the distance to the wall:
result = c_trace(my.x, nullvector,IGNORE_ME);
result now have the distance to the wall

Re: check the height of a block [Re: Widi] #375326
06/24/11 21:45
06/24/11 21:45
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
yes but I am looking for the height of the wall, not the distance to the wall.


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: check the height of a block [Re: DLively] #375330
06/24/11 21:56
06/24/11 21:56
Joined: Oct 2006
Posts: 873
S
Shadow969 Offline
User
Shadow969  Offline
User
S

Joined: Oct 2006
Posts: 873
easiest way - try tracing from several higher positions, while keeping the same angle. if next trace returns a bigger distance than previous - you found the highest point of the wall. of course this will work only with walls perpendicular to the floor, otherwise you'll have to think of another edge criteria.

so if you trace each 10 quants upwards for example - you can measure the block's height with average accurancy about 5 quants. in your case i'd choose to trace every 5 quants and if 5 traces return the same distance - the wall is 'unclimbable'.

hope that helps.

Re: check the height of a block [Re: DLively] #375331
06/24/11 22:02
06/24/11 22:02
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
Just an idea:
select a point inside the volume near the hit point ( e.g. adding the inverse normal). Now trace upwards. You can check this result for:

the trace hit nothing: it was an outer level wall

the trace hit a backside face: it is a block with a topside check the value wether it has the required height

the trace hit a frontside face: no clue what happens at this point


muffel

Last edited by muffel; 06/24/11 22:04.
Re: check the height of a block [Re: muffel] #375338
06/24/11 22:33
06/24/11 22:33
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
You said that you need to detect walls height for player to jump on it. Just make trace above player's head (if your players height is 25 quants, other way adjust height of the end position for the trace) 10 quant forward, so if it doesn't hit anything jump on it, other ways, don't. I hope it help, good luck.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: check the height of a block [Re: 3run] #375355
06/25/11 01:06
06/25/11 01:06
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
K I just can't figure it out!!!!!!!!!!

I've been trying every which way to do this and still nothing... the closest thing i can come up with is this:


But first, this code checks to see if my player is infront of a block, and if so then turns on the jumping var:
Code:
vec_set(checkaheadtemp,vector(5,0,0));
vec_rotate(checkaheadtemp,my.pan);
vec_add(checkaheadtemp,my.x);
trace_mode = ignore_me + ignore_models + ignore_sprites + use_box;
result = trace(my.x,checkaheadtemp);
if(result>0)&&(vec_dist(my.x,links_temp_jump_pos.x)>5)&&(link_on_ground==0){jump_obstacle=1;}



---------------

now this code, is my attempt at figuring this problem out.. but it works in the reverse, So if the block is higher than my players max jumping height, my player jumps..

Code:
vec_set(checkaheadtemp,vector(5,0,0));//check in front
vec_rotate(checkaheadtemp,my.pan);//in front of me
vec_add(checkaheadtemp,vector(my.x,my.y,my.z+25));//store my.x to my.z + trace height
trace_mode = ignore_me + ignore_models + ignore_sprites + use_box;
result = trace(vector(my.x,my.y,my.z+25),checkaheadtemp);
if(result>0){
	vec_set(checkaheadtemp,vector(5,0,0));
	vec_rotate(checkaheadtemp,my.pan);
	vec_add(checkaheadtemp,my.x);
	trace_mode = ignore_me + ignore_models + ignore_sprites + use_box;
	result = trace(my.x,checkaheadtemp);
	if(result>0)&&(vec_dist(my.x,links_temp_jump_pos.x)>5)&&(link_on_ground==0){jump_obstacle=1;}
}



any more ideas?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: check the height of a block [Re: DLively] #375357
06/25/11 01:33
06/25/11 01:33
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
okay..

I have another idea... but dont know where to go from here.

Basically:
Code:
vec_set(links_temp_jump_pos, vector(my.x,my.y,my.z+25));
c_trace(my.x,links_temp_jump_pos,ignore_me+ignore_models+ignore_sprites+use_box);


-store the height from link to "above link +25"
-then trace between link, and the stored array.

now i need to check to see if there is a block somewhere inbetween, otherwise it will just make him jump..

here is an image i made to help me ^_^



A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: check the height of a block [Re: DLively] #375366
06/25/11 08:03
06/25/11 08:03
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
No dude, make it like this:
Code:
VECTOR end_pos;

vec_set(end_pos,vector(10,0,my.max_z + 10));
vec_rotate(end_pos,my.pan);
vec_add(end_pos,my.x);

c_trace(my.x,end_pos,IGNORE_ME|IGNORE_PASSABLE);
if(trace_hit){/* DON'T JUMP*/}else{/*JUMP*/}

This is not tested, but should give you an idea. This is same as making player climb things, but there you would need second trace from players center.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

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