2 registered members (AndrewAMD, juanex),
1,247
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: c_trace and level geometry detection?
[Re: SirCamaris]
#303139
12/25/09 21:55
12/25/09 21:55
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Have a look at the syntax of c_trace in the manual.
c_trace (player.x, vector(player.x + 128, player.y, player.z),USE_BOX); if(trace_hit) { don't move } else { move }
To be on the safe side (the wall could be f.i. 128.1 quants away, depending on your movement code) you could increase the distance of your trace instruction. If c_trace hits something it will return the distance to the object/ wall.
result = c_trace (player.x, vector(player.x + 150, player.y, player.z),USE_BOX); if(trace_hit && result < 129 or some other value) { don't move } else { 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: c_trace and level geometry detection?
[Re: Superku]
#303289
12/27/09 21:42
12/27/09 21:42
|
Joined: Aug 2006
Posts: 70 NJ
SirCamaris
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 70
NJ
|
This is some of what I tried so far:
c_trace(player.x, vector(player.x + 128, player.y, player.z), IGNORE_ME); if (trace_hit = 1) {c_move(player, vector(0,0,0)nullvector, GLIDE);} else {move_forward();}
trace_hit appears to be working because the coordinates that I put in reldist vector in c_move get executed. What is odd however, is that when the level starts, the first wall in front of the player is more than 256 quants away, so trace_hit should really be 0. I'm thinking this may have something to do model placement, although in Wed, the model is within the corridor and isn't touching anything.
Thank you again for your continued help.
|
|
|
Re: c_trace and level geometry detection?
[Re: SirCamaris]
#303293
12/27/09 22:11
12/27/09 22:11
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
Expert
|
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
well, if you don't program a side scroller, you must put the c_trace in the directio of the player: c_trace(player.x, vector(player.x + 128*cos(player.pan)*cos(player.tilt), player.y+128*sin(player.pan)*cos(player.tilt), player.z+128*sin(player.tilt)), IGNORE_ME); this should work
|
|
|
Re: c_trace and level geometry detection?
[Re: Superku]
#304598
01/09/10 01:27
01/09/10 01:27
|
Joined: Aug 2006
Posts: 70 NJ
SirCamaris
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2006
Posts: 70
NJ
|
Superku I was able to get c_trace to work properly by building on your and Rei's comments. Here is the final version:
if (c_trace (player.x, vector(player.x + 128*cos(player.pan),
player.y + 128*sin(player.pan), player.z + 0), IGNORE_ME | USE_BOX) > 0)
{c_move (player, vector(0, 0, 0), nullvector, GLIDE);}
else
{move_forward();}
Thanks again for your help.
|
|
|
|