1 registered members (TipmyPip),
18,449
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Can c_trace and scan_texture work for a physics entity?
#214589
07/05/08 15:51
07/05/08 15:51
|
Joined: Sep 2006
Posts: 36 Tempe, AZ
bpc31
OP
Newbie
|
OP
Newbie
Joined: Sep 2006
Posts: 36
Tempe, AZ
|
I'm using the following code but the add_laps never gets triggered:
action boat { player = me; phent_settype(my, PH_RIGID, PH_BOX); ph_setgravity( earth_gravity ); phent_setmass(my, 70, PH_POLY); phent_setfriction(my,0); phent_setelasticity(my, 25, 1); phent_setdamping(my, 90, 90); while(1) { phent_getvelocity(my, velocity3, nullvector); velocity = vec_length(velocity3); if(key_cuu == 1) { vec_set(temp.x, my); vec_normalize(temp, 450000); phent_addforcelocal(my, temp, nullvector);fire(); } if(key_cud == 1) { vec_set(temp.x, my); vec_normalize(temp, -25000); phent_addforcelocal(my, temp, nullvector); } if(key_cul == 1 && velocity > 60) { phent_addtorqueglobal (my, vector(0, 0, 4000)); } if(key_cur == 1 && velocity > 60) { phent_addtorqueglobal (my, vector(0, 0, -6000)); } c_trace (temp.x, my, scan_texture|ignore_me); if (str_cmpi (tex_name, "checker1")) { add_laps(); } boat_camera(); wait(1); } }
|
|
|
Re: Can c_trace and scan_texture work for a physics entity?
[Re: bpc31]
#214694
07/06/08 14:36
07/06/08 14:36
|
Joined: Dec 2005
Posts: 490 Germany/Berlin-Velten
kasimir
Senior Member
|
Senior Member
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
|
Hi add this:
vec_set (temp.x, my.x);
temp.z -= 100;
c_trace (my.x, temp.x, scan_texture|ignore_me);
does "add_laps" use somethink to check when your leave the checker-texture? else your have tousands of laps when touching this texture!
Last edited by kasimir; 07/06/08 14:40.
|
|
|
Re: Can c_trace and scan_texture work for a physics entity?
[Re: kasimir]
#214895
07/08/08 01:54
07/08/08 01:54
|
Joined: Dec 2005
Posts: 116
tD_Datura_v
Member
|
Member
Joined: Dec 2005
Posts: 116
|
var ph_nForceX = 450000; // a bit high?
var ph_nForceXn = -25000;
var ph_nForceY = 4000;
var ph_nForceYn = -6000;
var ph_vForce[3];
STRING lapTx_s = "checker1";
var ct_nMode = 0;
var ct_nDown = 5; // * entity height
function phf_force(_nX, _nY, _nZ) {
ph_vForce.x = _nX;
ph_vForce.y = _nY;
ph_vForce.z = _nZ;
}
action boat {
player = me;
phent_settype(me, PH_RIGID, PH_BOX);
ph_setgravity( earth_gravity );
phent_setmass(my, 70, PH_POLY);
phent_setfriction(me, 0); // ERROR??? NO FRICTION?
phent_setelasticity(my, 25, 1);
phent_setdamping(my, 90, 90);
var bLapped; bLapped = 0;
while(me != NULL) {
phent_getvelocity(my, velocity3, nullvector);
velocity = vec_length(velocity3);
vec_set(temp, nullvector);
if(key_cuu == 1) {
//vec_set(temp.x, my); // ERROR??? // set v to e, temp, my.x
//vec_normalize(temp, 450000); // a bit high?
phf_force(ph_nForceX, 0, 0);
phent_addforcelocal(me, ph_vForce, nullvector);
fire();
}
if(key_cud == 1) {
//vec_set(temp.x, my); // ERROR??? // set v to e, temp, my.x
phf_force(ph_nForceXn, 0, 0);
phent_addforcelocal(me, ph_vForce, nullvector);
}
if(key_cul == 1 && velocity > 60) {
phf_force(0, 0, ph_nForceY);
phent_addtorqueglobal (me, ph_vForce);
// does angular damping slow it down
}
if(key_cur == 1 && velocity > 60) {
phf_force(0, 0, ph_nForceYn);
phent_addtorqueglobal (me, ph_vForce);
}
vec_set(temp, my.x);
temp.z -= ((my.max_z - my.min_z) * ct_nDown);
ct_nMode = IGNORE_ME | SCAN_TEXTURE | IGNORE_PASSABLE;
c_trace (my.x, temp, ct_nMode); // just temp, temp.x not needed
// that won't stop cheating
if (str_cmpi (tex_name, lapTx_s)) {
if (bLapped == 0) {
add_laps();
error("add_laps()");
}
bLapped = 1;
} else {
bLapped = 0;
}
boat_camera();
wait(1);
}
}
Of course, don't bother with that. It's useless.
|
|
|
|