Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TedMar, dr_panther), 1,049 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Player 1st-Person with Gravity #183899
02/14/08 17:32
02/14/08 17:32
Joined: Jan 2002
Posts: 454
Germany
CD_saber Offline OP
Senior Member
CD_saber  Offline OP
Senior Member

Joined: Jan 2002
Posts: 454
Germany
Hello,

i need a 1st-person-Player script, which works with mdl-terrains. It would be kind if someone can help me out of this. The player should be able to walk foward/backward , strafe and to be pulled down by gravity.

Thanks in advance!
CD_SABER

Last edited by CD_saber; 02/14/08 17:44.
Re: Player 1st-Person with Gravity [Re: CD_saber] #183900
02/14/08 21:13
02/14/08 21:13
Joined: Mar 2007
Posts: 75
M
Metal_Man Offline
Junior Member
Metal_Man  Offline
Junior Member
M

Joined: Mar 2007
Posts: 75
this should work if you're using A6

Code:


action player_ent
{
var input_vec[3];
var Vz = 0;
var jump_able = 1;
camera.genius = me;
while(1)
{
input_vec.x = (key_w - key_s) * time * 5;
input_vec.y = (key_d - key_a) * time * -5;
Vz += (Vz == 0) * 25 * key_space * jump_able;
if(Vz > 0)
{
jump_able = 0;
}
Vz -= (Vz > 0);
my.pan -= mickey.x;
camera.pan = my.pan;
camera.tilt -= mickey.y;
c_move(me,input_vec,nullvector,GLIDE);
c_move(me,nullvector,vector(0,0,(Vz - 10) * time),0);
if(trace_hit)
{
jump_able = 1;
}
vec_set(camera.x,my.x);
camera.z += 10;
wait(1);
}
}




Re: Player 1st-Person with Gravity [Re: Metal_Man] #183901
02/14/08 22:51
02/14/08 22:51
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
you forgot c_setminmax(me); to make sure that the model lands on its feet


- aka Manslayer101
Re: Player 1st-Person with Gravity [Re: mpdeveloper_B] #183902
02/16/08 15:19
02/16/08 15:19
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline
Senior Member
kasimir  Offline
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
you should also use vec_normalize or the player is faster if you walk forward while strafing than just walk forward... (without strafing)
...
input_vec.x = (key_w - key_s);
input_vec.y = (key_a - key_d);
vec_normalize(input_vec,time * 5);
...


Moderated by  adoado, checkbutton, mk_1, Perro 

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