Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
1 registered members (AndrewAMD), 1,534 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to scan geometry (for detect collision & dist) #112669
02/19/07 08:19
02/19/07 08:19
Joined: Jul 2006
Posts: 69
P
piposlav Offline OP
Junior Member
piposlav  Offline OP
Junior Member
P

Joined: Jul 2006
Posts: 69
Please post me a code:)

i want to know distance to walls or models too.(i have tried to use c_trace and c_scan ,but nothing happens)

Re: How to scan geometry (for detect collision & dist) [Re: piposlav] #112670
02/19/07 12:48
02/19/07 12:48
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
Puppeteer Offline
Expert
Puppeteer  Offline
Expert

Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
have you tried this:
variable=c_trace(bl4)
(bl4 is the normal trace stuff )


Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com
Re: How to scan geometry (for detect collision & dist) [Re: Puppeteer] #112671
02/19/07 14:07
02/19/07 14:07
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Try using c_trace in the manual you can see:

Quote:



Modifies:
target position where the ray hits the surface of the obstacle (maybe to place a blood stain there)






So, distance = vec_dist(my.x,target);
Its just a possible implementation.

Re: How to scan geometry (for detect collision & dist) [Re: demiGod] #112672
02/19/07 17:19
02/19/07 17:19
Joined: Jul 2006
Posts: 69
P
piposlav Offline OP
Junior Member
piposlav  Offline OP
Junior Member
P

Joined: Jul 2006
Posts: 69
i ve tried this
...
temp.x+=500;
dist=c_trace(my.x,temp.x,Ignore_ME|USE_BOX);

and engine give me only distance to models in level ,wall absolutely indetectable:)

i want script : if object is in dist (50m) call function.

Last edited by piposlav; 02/19/07 17:41.
Re: How to scan geometry (for detect collision & dist) [Re: piposlav] #112673
02/19/07 18:34
02/19/07 18:34
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Try this:

Code:


vec_set(temp, my.x);
temp.x += 1000; //distance ahead
c_trace(my.x,temp,IGNORE_ME+IGNORE_PASSABLE+IGNORE_MODELS+IGNORE_SPRITES+use_box);
if(trace_hit != 0 && you == null) //hitted something that isnt an entity
{
if(vec_dist(my.x, target) < 500)
{
beep;
}
}



Re: How to scan geometry (for detect collision & dist) [Re: demiGod] #112674
02/23/07 13:20
02/23/07 13:20
Joined: May 2006
Posts: 90
England
TigerTao Offline
Junior Member
TigerTao  Offline
Junior Member

Joined: May 2006
Posts: 90
England

var wall_finder[3];
var wall_result;

vec_rotate(wall_finder.x,my.pan); //rotate trace to players rotation
vec_add(wall_finder.x,vector(my.x,my.y,my.z)); // keep trace to player as he moves
wall_result = c_trace(my.x,wall_finder.x,ignore_me | ignore_passable); //find distance to wall

This code works for me to find distance of player from a wall. Also remember the trace needs to be rotated to the players facing direction.


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