3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Terrains and Movement
[Re: xxxxxxx]
#378480
07/24/11 06:47
07/24/11 06:47
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
"c_move" interact with everything, to interact with terrains you simply need to do this:
dist.x = 10 * (key_w - key_s) * time_step;
dist.y = 10 * (key_a - key_d) * time_step;
dist.z = 10 * (key_q - key_e) * time_step;
c_move(my,dist,nullvector,IGNORE_PASSABLE|GLIDE);
So you can move player with WSAD in X and Y coordinates, plus with QE in Z. Take a look at your "c_move", may be you are using "IGNORE_WORLD" in it. Or may be "IGNORE_FLAG2" and you terrain has FLAG2 set on... I can't see any other reasons.
|
|
|
Re: Terrains and Movement
[Re: 3run]
#378500
07/24/11 12:22
07/24/11 12:22
|
Joined: Oct 2008
Posts: 513
Carlos3DGS
OP
User
|
OP
User
Joined: Oct 2008
Posts: 513
|
I know how to use c_move, but thankyou for taking the time to reply in case I didnt. Just in case I post my movement code, mabe I am missing some mistake and someone else can help find it:
c_move(Boat,vector((key_cuu-key_cud)*20*time_step,0,0),nullvector,IGNORE_PASSABLE);
c_rotate(Boat,vector((key_cul-key_cur)*2*time_step,0,0),IGNORE_PASSABLE);
My terrain does not have the passable set so that should not be the problem. Just to make sure i removed the IGNORE_PASSABLE mode from the movement and I still have that problem... I just go right through the terrains
|
|
|
Re: Terrains and Movement
[Re: xxxxxxx]
#378501
07/24/11 12:38
07/24/11 12:38
|
Joined: Oct 2008
Posts: 513
Carlos3DGS
OP
User
|
OP
User
Joined: Oct 2008
Posts: 513
|
I found the problem. I modify my terrains at runtime with functions like these:
ENTITY* CurrSand;
int VecTotal = ent_status(Sand[2][2],0);//terrain total vectors
var VecDist;//store distance to terrain center
int tx; int ty; int i;
for (i=VecTotal; i>0; i--)
{
for(tx=0;tx<5;tx++)
{
for(ty=0;ty<5;ty++)
{
CurrSand=Sand[tx][ty];
CONTACT* c1 = ent_getvertex(CurrSand,NULL,i);
if(CurrSand.skill1==1)
{
VecDist=vec_dist(vector(((i-1)%33),(integer((i-1)/33)),0),vector(16,16,0));
if(VecDist<=10)
{
c1.v.y= (-1*((2*(VecDist))*(2*(VecDist))))+50;
}
else
{
c1.v.y= -360;
}
}
else
{
c1.v.y = -360;
}
ent_setvertex(CurrSand,c1,i);
}
}
}
I added a few lines of code after I modify the terrains to update the hull and it fixed the problem:
for(tx=0;tx<5;tx++)
{
for(ty=0;ty<5;ty++)
{
c_updatehull(Sand[tx][ty],1);
}
}
|
|
|
Re: Terrains and Movement
[Re: 3run]
#378552
07/24/11 17:31
07/24/11 17:31
|
Joined: Oct 2008
Posts: 513
Carlos3DGS
OP
User
|
OP
User
Joined: Oct 2008
Posts: 513
|
Another question regarding movement and collision. I want my player to glide around objects but never glide upwards (over hills). Is there any way to limit the glide along the z axis?
EDIT: nevermind... I found it "disable_z_glide = 1;"
New Question; My terrains have no feeling of depth, mainly because they have no shadow. I tried setting the SHADOW flag but it dosnt do anything. I think this is probably because I modify my terrains during runtime... Is there any way to get them to cast shadows on themselves again like pre-made terrains have?
Last edited by Carlos3DGS; 07/24/11 20:32.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|