Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Ayumi, NewbieZorro, TipmyPip), 13,888 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
gravity with c_move? #167068
11/13/07 03:14
11/13/07 03:14
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline OP
User
badapple  Offline OP
User

Joined: Apr 2006
Posts: 624
DEEP 13
hello can anyone please tell me how to add gravity to this players code

action playa()
{
player = my;
set(player,SHADOW | CAST);
set(my,SHADOW );
mat_shadow.alpha=40;
camera.tilt = -5;
while (1)
{
c_move (my, vector(40 * (key_w - key_s) * time_step, 0,0), nullvector, IGNORE_ME|IGNORE_PASSABLE);
camera.pan -= 8 * mouse_force.x * time_step - 8 * (key_a - key_d) * time_step;
camera.tilt += 8 * mouse_force.y * time_step; // on its x and y axis
player.pan = camera.pan; // the camera and the player have the same pan angle
camera.x = player.x - 200 * cos(player.pan);
camera.y = player.y - 200 * sin(player.pan); // use the same value (250) here
camera.z = player.z + 80; // place the camera above the player, play with this value
if ((key_w != 1) && (key_s != 1)) // the player isn't moving?
{
my.skill1 += 1*time_step;
if (my.skill1 > 100) my.skill1 -= 100;
ent_animate(me,"stand",my.skill1,ANM_CYCLE);
wait(1);
}
else
{
my.skill2 += 10*time_step;
if (my.skill2 > 100) my.skill2 -= 100;
ent_animate(me,"walk",my.skill2,ANM_CYCLE);
wait(1);
}
wait (1);
}
}


Re: gravity with c_move? [Re: badapple] #167069
11/13/07 04:58
11/13/07 04:58
Joined: Oct 2006
Posts: 873
S
Shadow969 Offline
User
Shadow969  Offline
User
S

Joined: Oct 2006
Posts: 873
replace
c_move (my, vector(40 * (key_w - key_s) * time_step, 0,0), nullvector, IGNORE_ME|IGNORE_PASSABLE);
with
c_move (my, vector(40 * (key_w - key_s) * time_step, 0,0), vector(0,0,-10) , IGNORE_ME|IGNORE_PASSABLE);//global gravity

Re: gravity with c_move? [Re: Shadow969] #167070
11/13/07 05:06
11/13/07 05:06
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline OP
User
badapple  Offline OP
User

Joined: Apr 2006
Posts: 624
DEEP 13
thank you for your fast reply , but i have tried this already and my player
will not move on my hmp terrian .... that seems to stick him to the ground
well he'll move a bit if the slope is downwards then get stuck and not be able to move up any slopes

any other suggestions?


Re: gravity with c_move? [Re: badapple] #167071
11/13/07 05:39
11/13/07 05:39
Joined: Oct 2006
Posts: 873
S
Shadow969 Offline
User
Shadow969  Offline
User
S

Joined: Oct 2006
Posts: 873
add GLIDE to move_mode, try to reduce gravity, try to lower origin in players model... yoy can try many things i think glide will do it

Re: gravity with c_move? [Re: Shadow969] #167072
11/13/07 05:41
11/13/07 05:41
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline OP
User
badapple  Offline OP
User

Joined: Apr 2006
Posts: 624
DEEP 13
thanks i,ll try that

Re: gravity with c_move? [Re: badapple] #167073
11/13/07 06:19
11/13/07 06:19
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline OP
User
badapple  Offline OP
User

Joined: Apr 2006
Posts: 624
DEEP 13
yes glide was the problem my model now moves up slopes ,thank you
but now it slides down slopes when im not moving. but at least im moving thnxs
again

Re: gravity with c_move? [Re: badapple] #167074
11/14/07 18:08
11/14/07 18:08
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline OP
User
badapple  Offline OP
User

Joined: Apr 2006
Posts: 624
DEEP 13
well ive solved my sliding down slopes problem , i use a seperate c_move instruction when the movement keys are not being pressed without glide and the sliding stops

thanks again shadow969

Re: gravity with c_move? [Re: badapple] #167075
11/17/07 10:12
11/17/07 10:12
Joined: Nov 2007
Posts: 14
F
FiskFisk33 Offline
Newbie
FiskFisk33  Offline
Newbie
F

Joined: Nov 2007
Posts: 14
i dunno, im a beginner at this, but why not just make a c_move without glide for gravity, and one with glide for movemet?

this should make your char not glide down slopes, but being able to move (in my head atleast...)

am i all wrong?

plus, wouldnt c_glide make for a quit not-realistic way to make gravity, as it isnt an accelerated movement...??

Last edited by FiskFisk33; 11/17/07 10:16.
Re: gravity with c_move? [Re: FiskFisk33] #167076
11/17/07 11:59
11/17/07 11:59
Joined: Aug 2003
Posts: 7,440
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,440
Red Dwarf


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: gravity with c_move? [Re: Michael_Schwarz] #167077
11/17/07 12:47
11/17/07 12:47
Joined: Nov 2007
Posts: 14
F
FiskFisk33 Offline
Newbie
FiskFisk33  Offline
Newbie
F

Joined: Nov 2007
Posts: 14
seems awesome, but i cant get it to work

couple of errors i get is:
'define' : undeclared identifier
'absSpeed_z' : is not a member if 'ENTITY'

im proboably missing something quite ovibious


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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