Jump to content

I don't get fall damage


Recommended Posts

Hi everyone,

 

it might be a stupid question but i just startet working with Leadwerks and LUA. So i am doing the tutorial series available here -> youtube and i have the problem that the player doesn't die when he falls from a high position. Everything else from the tutorial is working but maybe i missed something at the beginning? I remember that something didn't work at the beginning regarding the "name" value of the player. In the tutorial it was just "player" but in my version the value was "FPSPlayer". So i had to rename it to "player" to make the tutorial work on LW 4.5. Perhaps that's the problem?

I attached my project and it would be really helpful if someone could have a look at it or just point me into the right direction. 

 

tutorial.7z

Link to comment
Share on other sites

It is really great to see that people are still making use of these tutorials, even though they are a bit outdated.

The problem lies in the Collision function. Th 4th parameter is speed. When you print out the value to the screen you will see that it is 0 and therefor not afflicting damage to the player.

function Script:Collision(entity,position,normal,speed)
    System:Print("speed:" ..speed)
    if speed>20 and entity:GetKeyValue("name") ~= "DeathTrigger" then
        self:Hurt(100)
    end
end

Obiously the speed value should not be 0. This does seem like a bug imo. Maybe something that slipped in with 4.5. I tried the same map with the beta version and the problem persists. This can be a good bug report.

Link to comment
Share on other sites

This might be because I remember switching the order in which raycasts and collisions are done in the character physics...I will take a look.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...