0 registered members (),
1,251
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: KH Movement - Old and still on wheels
[Re: DLively]
#268531
05/29/09 20:37
05/29/09 20:37
|
Joined: Sep 2006
Posts: 292
Mythran
OP
Member
|
OP
Member
Joined: Sep 2006
Posts: 292
|
action ent_player(){ player = my; //wait(1); //c_setminmax(my); //c_updatehull(my,1); my.POLYGON = on; enable_polycollision = 2; my.narrow = on; while(1) {wait(1); camra(); gravity(); ent_cycle("stand", my.skill4); my.skill4 += 5 * time; my.skill4 %= 100; if(key_w){ ent_cycle("run", my.skill4); my.skill4 += my.skill1 * time; my.skill1 += 0.5; } else{ my.skill1 = 0; } my.skill1 = clamp(my.skill1,-4,4); c_move(me,my.skill1,nullvector,glide);
vec_set(temp, my.x); temp.z = -4000; trace_mode = use_box + ignore_passable + glide; //glide \ignore_me -trace(my.x, temp); if(key_space && my.jump==0&&result<5){//JUMP my.skill3 += jump_height; my.jump = 1; while(my.jump == 1){wait(1); camra(); ent_cycle("jump", my.skill7); if(my.skill7 < 100){ my.skill7 += 20; //20 }else{gravity();} vec_set(temp, my.x); temp.z = -4000; trace_mode = use_box + ignore_me + ignore_passable + glide; // glide -trace(my.x, temp); if((my.skill7 >= 90) && (result < 7)){my.jump=0;} c_move(me,my.skill1,nullvector, use_box + ignore_me + glide + ignore_sprites); //use_box \ -ignore_models \ignore_me vec_set(checkuptemp,vector(0,0,35)); vec_rotate(checkuptemp,my.pan); vec_add(checkuptemp,my.x); result = trace(my.x,checkuptemp); IF (result != 0) {gravity();my.skill3 = -2;} } my.skill7 = 0; } }
This is a bit a mission impossible, but i'm having some problems with models when i jump to them. The player enter a bit into the model and cannot move instead of walking on it. I tryed to mess with traces, but everything stood almost the same. If anyone can please help me. Thanks
|
|
|
Re: KH Movement - Old and still on wheels
[Re: Mythran]
#268556
05/29/09 23:11
05/29/09 23:11
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
Do you remember testDummy's advices? They were the right ones. Have a close look into the manual, even experienced programmers have to have a look into it from time to time, to remember the right use of the engine's functions. As testDummy said - I don't know, why he removed his post - the flag 'my.POLYGON = on;' has to be set only for the NOT moving entities! Not for the player itself or any other moving entity! From the online manual:(you make the most effective use of it, when you push CTRL + F(at least in firefox and netscape) and then search for a certain index) http://www.conitec.net/beta/collision.htmPOLYGON Use this for sprites or models that should act as polygonal obstacle. Don't use it for moving actors! Another thing: When you push F11 twice, you'll see the bounding box of the entities. Set and reset c_setminmax to see how it changes. For moving it should be a bit above the ground, you can achieve this with the following combination: A) set the bounding box slightly _above_ the ground, and B) reduce the bottom part of the bounding box a bit with min_z = 0; for instance In the manual it is the term c_move, where you find an example of a move code: http://www.conitec.net/beta/ac_move.htm// determine the ground distance by a downwards trace var dist_down; if (c_trace(my.x,vector(my.x,my.y,my.z-5000),IGNORE_ME | IGNORE_PASSABLE | USE_BOX) > 0) dist_down = my.z + vFeet.z - target.z; // get distance between player's feet and the ground else dist_down = 0; Completely other possible reason for your problems: How big is your player entity, IMO a size of about 40 quants is a good size for such entities - but it is possible that others have different experiences.
|
|
|
Re: KH Movement - Old and still on wheels
[Re: Mythran]
#268793
05/31/09 06:52
05/31/09 06:52
|
Joined: Apr 2009
Posts: 298 Southern Oceans
KiwiBoy
Member
|
Member
Joined: Apr 2009
Posts: 298
Southern Oceans
|
Try c_trace instead of trace mode. Follow above advice. remove my.polgon = on; remove enable_polycollision = 2; that should be in main as far as I know (which isnt a lot ![smile smile](/ubb7/images/graemlins/default_dark/smile.gif) ) Make an action for your model, action models() { set(my, POLYGON); } ...and you should be good to go.
Use the 'manual' Luke, the manual is your friend. 'Self reminder' My WebPage
|
|
|
Re: KH Movement - Old and still on wheels
[Re: Mythran]
#268811
05/31/09 09:24
05/31/09 09:24
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
I kept trying changing the values in c_trace, like ignore_me + models etc... Kiwi Boy mentioned it, but I want to assure that you understand: 'trace' (as used in you code) is NOT the same as 'c_trace'. You have to change that. 'trace' is old syntax and it is unable to handle models as complex obstacles with polygon = on! And, changing 'trace' to 'c_trace' means more than changing the word, look into the manual for this.
|
|
|
Re: KH Movement - Old and still on wheels
[Re: Cowabanga]
#268945
05/31/09 22:03
05/31/09 22:03
|
Joined: Sep 2006
Posts: 292
Mythran
OP
Member
|
OP
Member
Joined: Sep 2006
Posts: 292
|
var video_mode = 8; var video_depth = 32; var video_screen = 1; var fps_max = 100;
var camera_distance = 200; var camera_pan; var camera_tilt; var camera_move_to[3];
var jump = 0; var jump_height = 8; var checkuptemp[3];
var dist_down;
define jump = skill21;
entity* player;
function main() { level_load("level.wmb"); enable_polycollision = 2; }
function cam() { camera_pan -= mouse_force.x * 10 * time; camera_tilt += mouse_force.y * 6 * time; camera_tilt = clamp(camera_tilt,-45,20); my.pan = camera_pan; camera.pan = camera_pan; temp = fcos(camera_tilt,-camera_distance); vec_set(camera_move_to.x,vector(my.x + fcos(camera.pan,temp),my.y + fsin(camera.pan,temp),my.z + 20 + fsin(camera_tilt,-camera_distance))); temp = min(1,0.5 * time); camera.x += temp*(camera_move_to.x - camera.x); camera.y += temp*(camera_move_to.y - camera.y); camera.z += temp*(camera_move_to.z - camera.z); vec_diff(temp.x,camera.x,my.x); vec_normalize(temp.x,16); vec_add(temp.x,camera.x);
trace_mode = ignore_me + ignore_passable + glide; IF (trace(my.x,temp.x) > 0) { vec_diff(temp.x,my.x,target.x); vec_normalize(temp.x,16); vec_set(camera.x,target.x); vec_add(camera.x,temp.x); }
vec_diff(temp.x,my.x,camera.x); vec_to_angle(camera.pan,temp.x); }
function gravity() { vec_set(temp, my.x); temp.z = -5000; trace_mode = ignore_me + use_box + ignore_sprites + glide; -trace(my.x, temp); if(result > 25){my.skill3 -= 2 * time;} else { my.skill3 = -trace(my.x, temp)* 0.5; } }
action ent_player() { player = my; wait(1); //c_setminmax(my); my.narrow = on; while(1) { wait(1); cam(); gravity(); ent_cycle("stand", my.skill4); my.skill4 += 5 * time; my.skill4 %= 100; if(key_w) { ent_cycle("run", my.skill4); my.skill4 += my.skill1 * time; my.skill1 += 0.5; } else { my.skill1 = 0; } my.skill1 = clamp(my.skill1,-4,4); c_move(me,my.skill1,nullvector,IGNORE_ME|USE_BOX|GLIDE);
vec_set(temp, my.x); temp.z = -5000; c_trace (my.x,temp, USE_BOX|IGNORE_ME|IGNORE_PASSABLE|GLIDE); if(key_space && my.jump==0&&result<5) { my.skill3 += jump_height; my.jump = 1; while(my.jump == 1) { wait(1); Cam(); ent_cycle("jump", my.skill7); if(my.skill7 < 100) { my.skill7 += 20; } else { gravity(); } vec_set(temp, my.x); temp.z = -5000; c_trace (my.x,temp, USE_BOX|IGNORE_ME|IGNORE_MODELS|IGNORE_PASSABLE|GLIDE); if((my.skill7 >= 90) && (result < 7)) { my.jump=0; } c_move(me,my.skill1,nullvector,USE_BOX|IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|GLIDE); vec_set(checkuptemp,vector(0,0,35)); vec_rotate(checkuptemp,my.pan); vec_add(checkuptemp,my.x); result = trace(my.x,checkuptemp); IF (result != 0) { gravity();my.skill3 = -2; } } my.skill7 = 0; } } }
action Models_Poly() { my.POLYGON = on; }
Ok here's the whole code. I change to C_trace what i could/managed. But i got worst, changed some values in IGNORE_ME|IGNORE_MODELS and it got worst. If anyone can please fix this problem... I spent the day repeating the same thing and found no way to solve the problem of the entity interacting with models. All my guesses are that it really has to do with c_trace and c_move and apply the Ignore_me|glide, etc... Thanks for all the help until now.
|
|
|
|