|
2 registered members (TipmyPip, izorro),
556
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Impact event not working with still objects
#89329
09/09/06 22:07
09/09/06 22:07
|
Joined: Jan 2006
Posts: 20
carcorde
OP
Newbie
|
OP
Newbie
Joined: Jan 2006
Posts: 20
|
I have in my level some objects which fall and break the players`s car windshield. The problem is that as long as they are moving, everything works fine, but when they are standing still, i.e, when they reach their animation last frame and stop, as they hit the ground, the impact event wonīt work. Some objects are supposed to fall, stay on the ground, and form a kind of obstacle course for the player to get around. But the car is going thru them, I canīt figure out why. This code is working for the other entities, even when they just hover in place:
action falling_oneshot {
while (1)
{
if ((vec_dist (camera.x, my.x) < 3000)) { ent_animate(me, "fall", my.skill12, null); // "fall" animation my.skill12 += 0.6 * time; // "fall" animation speed my.enable_impact = ON; // breaks things my.EVENT = crash_event; } wait(1); } }
Does the impact event only work if the entity is moving?
If anyone can help me , Iīd be grateful.
|
|
|
Re: Impact event not working with still objects
[Re: Why_Do_I_Die]
#89331
09/10/06 00:04
09/10/06 00:04
|
Joined: Jan 2006
Posts: 20
carcorde
OP
Newbie
|
OP
Newbie
Joined: Jan 2006
Posts: 20
|
The code is working in every instance, with no problems whatsoever except in this particular case, where the entity is animated until its last animation frame (an animated fall) and stops, becoming an obstacle, or I hoped it would. Elsewhere, it works fine. Thatīs the code:
function crash_event() { while(1) { if (EVENT_TYPE == Event_impact) // { // if (glass_health < 6)/// this was to limit the number of impacts///for testing purposes { ENT_playSOUND(MY,crash_wav,80); glass_health = glass_health + 0.05; glass_stats = glass_stats + 1; cracking += 0.05; } wait (1); } }
I even used a very simplified version of this code that only plays a sound if the hit occurs, only to try and debug it, to no avail.
Maybe it is the push parameters, even though I didn`t use it anywhere and the impact works everywhere but in this case. I know that I could use something like "my.push = 'some value'" on each entityīs code, but which one has to have the higher value, the player entity or the obstacle? I suppose it is the obstacle, or both with the same value, if I understood the manual correctly? Iīll try that.
|
|
|
Re: Impact event not working with still objects
[Re: carcorde]
#89332
09/10/06 00:19
09/10/06 00:19
|
Joined: Jan 2006
Posts: 20
carcorde
OP
Newbie
|
OP
Newbie
Joined: Jan 2006
Posts: 20
|
I tryed applying push values to both the player and the obstacle entity and the player continues to go thru the freaking obstacle.
If I take the same model (a piano, in the case. And yes, it is an ACME piano), but WITHOUT any animation, and place it in the middle of the road, with the same code (minus the animation ralated part) it works perfectly. Also, if I do not stop the animation, and hit the car with the object while it is still moving, the impact works.
So it is neither the model nor the code, I suppose. It has something to do with the animation being frozen, maybe? I donīt know. Any ideas?
|
|
|
Re: Impact event not working with still objects
[Re: carcorde]
#89333
09/10/06 09:06
09/10/06 09:06
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
maybe a: c_updatehull(my,my.frame); would work. quote from the manual: Quote:
c_updatehull(ENTITY* ent, var frame) Recalculates collision hulls for the given entity to match the vertex positions of a certain frame (starting at 1 for first frame).
|
|
|
Re: Impact event not working with still objects
[Re: carcorde]
#89335
09/10/06 15:06
09/10/06 15:06
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
You should add the event_entity, so: my.enable_entity = on; and if(event_type == event_impact || event_type == event_entity) { windshield breaks } Quote:
event_entity entity.enable_entity Collision with another entity during MOVE. The entity must not be PASSABLE and it's PUSH value must be equal or less than the PUSH value of the other entity. The YOU pointer is set to the other entity, NORMAL and BOUNCE are set as before.
Quote:
event_impact entity.enable_impact Hit by another entity that performed a MOVE and had a lower or equal PUSH parameter. Neither entity must be PASSABLE. You is set to the other entity. Normal and BOUNCE are also set to give the direction perpendicular to the moving surface and the direction into which the entity would bounce.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|