2 registered members (AndrewAMD, TipmyPip),
12,420
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Collisions not happening in WDL converted to LiteC
#141904
07/18/07 18:26
07/18/07 18:26
|
Joined: Aug 2006
Posts: 41 Racine, WI, USA
dreadFusemonkey
OP
Newbie
|
OP
Newbie
Joined: Aug 2006
Posts: 41
Racine, WI, USA
|
So, I have an A6.6 C-Script project with a gun based on the Weapons AUMs, specifically launching a projectile (bullet) as a model vs. using c_trace. What I have found after converting it over to A7 Lite-C is that the bullets typically stop just short of impacting other entities, and the impact never occurs.
I then created another based on the bow/arrow script in a really early AUM and the grenade launcher from Weapons part 3 AUM so that I had an arrow that arcs as opposed to flying in a straight line. It works great except that the arrows most often stop just shy of impacting.
Is this a known problem? Why doesn't my gun/bullet code work in A7 when it worked in A6.6? I've tried every trick I know which isn't saying much. Has anyone here encountered this or heard of it? Anybody have any insight?
Thanks much.
To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
|
|
|
Re: Collisions not happening in WDL converted to L
[Re: dreadFusemonkey]
#141905
07/19/07 07:33
07/19/07 07:33
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
show us your code. collision in lite-C should be just fine (always has been for me).
julz
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Collisions not happening in WDL converted to L
[Re: JibbSmart]
#141906
07/19/07 14:03
07/19/07 14:03
|
Joined: Aug 2006
Posts: 41 Racine, WI, USA
dreadFusemonkey
OP
Newbie
|
OP
Newbie
Joined: Aug 2006
Posts: 41
Racine, WI, USA
|
Code:
ENTITY* weapon1; // pointer to our weapon model STRING* weapdisp = "Hello?"; TEXT* weapdisp_text = { pos_x=300; pos_y=500; font=_a4font; string=weapdisp; flags=visible; }
... snipped code here ...
function fire_bullets() { proc_kill(4); // don't allow more than 1 copy of this function to run while (mouse_left == ON) // this loop runs for as long as the left mouse button is pressed { vec_for_vertex (temp.x, weapon1, 29); // get the coordinates for the bullets' origin // create the bullet at camera's position and attach it the "move_bullets" function ent_create (muzzle_pcx, temp.x, display_muzzle); // create the gun muzzle //temp.x += 100; ent_create (bullet_mdl, camera.x, move_bullets); /// use camera.x and not the weapon vertex snd_play (bullet_wav, 100, 0); // play the bullet sound at a volume of 100 wait(7); // adjust this to get the rpm you want } }
function move_bullets() { VECTOR bullet_speed; // this var will store the speed of the bullet set(my,ENABLE_ENTITY|ENABLE_IMPACT); my.event = remove_bullets; // when it collides with something, its event function (remove_bullets) will run my.pan = camera.pan; // the bullet has the same pan my.tilt = camera.tilt; // and tilt with the camera my.push=5; bullet_speed.x = 300 * time_step; // adjust the speed of the bullet here bullet_speed.y = 0; //random(2); // allow windage... will make this an external calculation bullet_speed.z = 0; // allow gravity while (my != NULL) // this loop will run for as long as the bullet exists (it isn't "null") { // move the bullet ignoring the passable entities and store the result in distance_covered c_move (my, bullet_speed, nullvector, IGNORE_PASSABLE); wait (.1); } }
void remove_bullets() // this function runs when the bullet collides with something { wait (1); // wait a frame to be sure (don't trigger engine warnings)
str_cpy((weapdisp_text.pstring)[0],"Test!"); /// <-- this never happens! effect (particle_blood, 100, my.x, normal); if( you != NULL ){ str_for_entfile(weapdisp,you); if(str_cmpi(weapdisp,"TOON_CRITTER2.MDL")==0) { str_for_entfile (weapdisp,you); if(str_cmpi(weapdisp,"MOUND2B.MDL")==1) { effect(particle_dust, 15, my.x, normal); } else { effect(particle_dust, 5, my.x, normal); } } else { spawn_physics(you); } } set(my,PASSABLE|INVISIBLE); // the bullets becomes passable and invisible now wait(2); // wait until the explosion_sprite() function is over ent_remove (my); // and then remove the bullet }
... more snipped code ...
To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
|
|
|
Re: Collisions not happening in WDL converted to L
[Re: dreadFusemonkey]
#141907
07/19/07 15:28
07/19/07 15:28
|
Joined: Aug 2006
Posts: 41 Racine, WI, USA
dreadFusemonkey
OP
Newbie
|
OP
Newbie
Joined: Aug 2006
Posts: 41
Racine, WI, USA
|
I whittled the remove_bullets() function down to this... Code:
void remove_bullets() // this function runs when the bullet collides with something { wait (1); // wait a frame to be sure (don't trigger engine warnings) str_cpy(weapdisp,"Test!"); set(my,PASSABLE|INVISIBLE); // the bullets becomes passable and invisible now ent_remove (my); // and then remove the bullet }
...just to simplify life for debugging sake. same thing. Bullet seems to just touch the surface of the entity it hits, and stops there. It doesnt do any of the stuff in remove_bullets() though. This occurs when hitting my terrain model, and any of the models I have on it. For reference, the following action is applied to a rock model: Code:
action mound() { set(my,CAST|SHADOW|POLYGON|TRANSLUCENT); my.scale_x=3; my.scale_y=3; my.scale_z=3; my.push = 1; //wait(3); c_trace(my.x,vector(my.x,my.y,my.z-10000),IGNORE_ME|IGNORE_PASSABLE); if(you != NULL) { target.z-=15; vec_set(my.x,target.x); //vec_to_angle(my.pan, normal); // put on surface } wait(1); reset(my,TRANSLUCENT);
}
To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
|
|
|
Re: Collisions not happening in WDL converted to L
[Re: dreadFusemonkey]
#141908
07/19/07 21:34
07/19/07 21:34
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
for event setting the manual uses "my.emask |= ENABLE_ENTITY|ENABLE_IMPACT;"
i don't know if that's the problem because your usage isn't producing error messages.
sorry i can't be more help.
julz
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Collisions not happening in WDL converted to L
[Re: JibbSmart]
#141909
07/19/07 23:02
07/19/07 23:02
|
Joined: Aug 2006
Posts: 41 Racine, WI, USA
dreadFusemonkey
OP
Newbie
|
OP
Newbie
Joined: Aug 2006
Posts: 41
Racine, WI, USA
|
Thanks JulzMighty. That was exactly the tip I needed. All of these different flag types have got me confused, so I'm going to study atypes.h and peruse the manual again.
To crush your enemy...see them driven before you, and to hear da lamentation of da vimmen!
|
|
|
|