Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
character collision #146553
08/07/07 22:51
08/07/07 22:51
Joined: Aug 2005
Posts: 390
Florida
O
oldschoolj Offline OP
Senior Member
oldschoolj  Offline OP
Senior Member
O

Joined: Aug 2005
Posts: 390
Florida
Does anyone know why, when my player hits a wall, they go straight up to the top?
Code:
action players_code ()
{
on_alt = toggle_movemode;
player = my; // I'm the player
while (1)
{
my.pan += 6 * (key_a - key_d) * time_step; // rotate the player using the "A" and "D" keys
vec_set (temp2.x, my.x); // copy player's position to temp
temp2.z -= 5000; // set temp.z 5000 quants below player's origin
distance_to_ground = c_trace (my.x, temp2.x, IGNORE_ME | IGNORE_PASSABLE | USE_AABB);
if ((key_w == 0) && (key_s == 0))// the player isn't moving?
{
movement_speed.x = 7 * (key_w - key_s) * time_step; // move the player using "W" and "S"
movement_speed.y = 0; // don't move sideways
movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value
movement_speed.z = maxv (-35 * time_step, movement_speed.z); // 35 = falling speed
c_move (my, movement_speed.x, nullvector, IGNORE_PASSABLE);
ent_animate(my, "stand", anim_percentage_stand, ANM_CYCLE); // play the "stand" animation
}
if ((run_toggle == 1) && (key_s == 1))
{
movement_speed.x = 15 * (key_w - key_s) * time_step; // move the player using "W" and "S"
movement_speed.y = 0; // don't move sideways
movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value
movement_speed.z = maxv (-35 * time_step, movement_speed.z); // 35 = falling speed
c_move (my, movement_speed.x, nullvector, IGNORE_PASSABLE);
ent_animate(my, "run", anim_percentage_run, ANM_CYCLE);
}
if ((run_toggle == 1) && (key_w == 1))
{
movement_speed.x = 15 * (key_w - key_s) * time_step; // move the player using "W" and "S"
movement_speed.y = 0; // don't move sideways
movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value
movement_speed.z = maxv (-35 * time_step, movement_speed.z); // 35 = falling speed
c_move (my, movement_speed.x, nullvector, IGNORE_PASSABLE);
ent_animate(my, "run", anim_percentage_run, ANM_CYCLE); // play the "stand" animation
}
if ((run_toggle == 0) && (key_w == 1))// the player is moving?
{
movement_speed.x = 7 * (key_w - key_s) * time_step; // move the player using "W" and "S"
movement_speed.y = 0; // don't move sideways
movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value
movement_speed.z = maxv (-35 * time_step, movement_speed.z); // 35 = falling speed
c_move (my, movement_speed.x, nullvector, IGNORE_PASSABLE);
ent_animate(my, "walk", anim_percentage_walk, ANM_CYCLE); // play the "walk" animation
}
if ((run_toggle == 0) && (key_s == 1))// the player is moving?
{
movement_speed.x = 7 * (key_w - key_s) * time_step; // move the player using "W" and "S"
movement_speed.y = 0; // don't move sideways
movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value
movement_speed.z = maxv (-35 * time_step, movement_speed.z); // 35 = falling speed
c_move (my, movement_speed.x, nullvector, IGNORE_PASSABLE);
ent_animate(my, "walk", anim_percentage_walk, ANM_CYCLE); // play the "walk" animation
}
anim_percentage_entwalk += 5 * time_step;
anim_percentage_stand += 4 * time_step; // 5 = animation speed
anim_percentage_walk += 5 * time_step;
anim_percentage_run += 6 * time_step;
// move the player
c_scan(player.x, player.pan, vector(100, 100, 1000), IGNORE_ME | SCAN_ENTS |SCAN_LIMIT);
wait (1);
}
}




you can find me with my face in the keyboard, unshaven, listening to some nameless techno tragedy, and hashing through code over a cold cup a stale joe. __________________________________ yours truly
Re: character collision [Re: oldschoolj] #146554
08/07/07 23:54
08/07/07 23:54
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
A player going up a wall is usually a sign for an entity being inside a wall and therefore tracing even as inside an object and therefore trying to escape upwards...


Always learn from history, to be sure you make the same mistakes again...
Re: character collision [Re: Uhrwerk] #146555
08/08/07 00:00
08/08/07 00:00
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi oldschoolj!

Looking at your code I was wondering about this line

movement_speed.z = - (distance_to_ground - 17); // 17 = experimental value

are you sure you wanted = - and not -=

Ottawa

Re: character collision [Re: Ottawa] #146556
08/31/07 20:02
08/31/07 20:02
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
I found that by using c_rotate for panning stopped most instances of this happening then using z_glide = 1 (depending on the size of the character) sorted a few more out and experimenting with c_move .z forces for gravity cleared up the rest but then I had probs with ease of game play.


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