Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (TipmyPip, izorro), 556 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Impact event not working with still objects #89329
09/09/06 22:07
09/09/06 22:07
Joined: Jan 2006
Posts: 20
C
carcorde Offline OP
Newbie
carcorde  Offline OP
Newbie
C

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: carcorde] #89330
09/09/06 23:30
09/09/06 23:30
Joined: May 2005
Posts: 819
U.S.
Why_Do_I_Die Offline
Warned
Why_Do_I_Die  Offline
Warned

Joined: May 2005
Posts: 819
U.S.
Theres Impact and Push , though you should me able to use impact , you have to enable impact on both entities which are going to impact. Maybe your crash_event isnt set up properly ? You should post your crash event code here so we can see if theres anything strange with it. Push values are also important to determine if something will impact with something else or ignore it and pass right through it.

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
C
carcorde Offline OP
Newbie
carcorde  Offline OP
Newbie
C

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
C
carcorde Offline OP
Newbie
carcorde  Offline OP
Newbie
C

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 Offline
Expert
Xarthor  Offline
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: Xarthor] #89334
09/10/06 14:07
09/10/06 14:07
Joined: Jan 2006
Posts: 20
C
carcorde Offline OP
Newbie
carcorde  Offline OP
Newbie
C

Joined: Jan 2006
Posts: 20
Thunder,
Yes, thanks, that fixed the problem, but only partially. The impact event is happening now, the carīs windshield is breaking as it should, but the sound event is not happening. I guess the piano itself should be moving for it to happen? Iīll tweak the code a little and see if I can fix it.

Thanks again.

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 Offline
Expert
Xarthor  Offline
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.






Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1