Author Topic: Armor::onCollision never being called even if being defined.  (Read 952 times)

I defined armor::onCollision
as

   function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f) {
      talk(":o");
      %r = Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);

      return %r;
   }

and nothing happened. The package was active and if I did isFunction(Armor, "onCollision") returned true. Though tracing onCollision is never called.
Any help?

Armor::onCollision only occurs at extremely high speeds compared to other onCollision functions - as a rough rule of thumb, if you're not going fast enough to take damage from falling, you're not going fast enough to trigger it.

Armor::onCollision only occurs at extremely high speeds compared to other onCollision functions - as a rough rule of thumb, if you're not going fast enough to take damage from falling, you're not going fast enough to trigger it.
I thought only if you touch an object (Such as another aiplayer or a player).. Do you mean Armor::OnImpact?

I fixed it by package onPlant/onLoadPlant to set brick.enableTouch = 1 then I packaged fxDTSBrickData::onPlayerTouch(%this, %brick, %player)

Do you mean Armor::OnImpact?

I knew there was something that used .onImpact.

The package was active and if I did isFunction(Armor, "onCollision") returned true.

Did you check with isFunction before or after defining the package?

Huh. Wait. No. Okay. Here's why. For players, .onCollision is used for things like items, while .onImpact is (I think) used for almost everything else, like players and bricks.

EDIT: Hurr double toast.

Xalos' second post is correct.

Armor::onCollision will only be triggered when you hit another world object like a player or item or bullet. This will not be called when you collide with the ground (or in past versions interior objects). Armor::onImpact will be called when you slam into something, regardless of what it is. It's supposed to be for falling damage. You can alter the player datablock's minImpact value to make this usable, but be careful to ensure to mitigate falling damage appropriately so you don't die from jumping.