linnik Posted August 20, 2018 Share Posted August 20, 2018 Hello to everyone, is it possible to detect type (road, off-road, grass, sand etc.) of ground on current player position? Link to comment Share on other sites More sharing options...
notsosmart Posted August 20, 2018 Share Posted August 20, 2018 Two ways (One of them impossible at the moment due to a pointer parameter return). The first is checking the players last hit material. The second is manually doing a raycast with the extended results. (Possible in 0.4) entity.getLastMaterialHitBy(); Will return the hash number of the material hit. You can then check against these values. https://pastebin.com/gyHjsYBK They might have changed however. You can hunt for them in the game files. You might also get away with using mp.game.joaat("concrete_pothole") or mp.game.gameplay.getHashKey("concrete_pothole") for example and see which one is valid. In the next update you can use this set. Which will return a hash number again but isn't dependent on an entity. Then you compare the result against the list again. mp.game.worldprobe.castRayPointToPoint mp.game.worldprobe.getShapeTestResultEx However if you're willing to experiment and try to duplicate the raycast process. You can try spawning an invisible object at the designated location (use mp.raycasting.testPointToPoint and get the hit coordinates) and then using getLastMaterialHitBy() on that object. This might work but I'm not sure. 1 Link to comment Share on other sites More sharing options...
linnik Posted August 22, 2018 Author Share Posted August 22, 2018 В 20.08.2018 в 20:18, notsosmart сказал: Two ways (One of them impossible at the moment due to a pointer parameter return). The first is checking the players last hit material. The second is manually doing a raycast with the extended results. (Possible in 0.4) entity.getLastMaterialHitBy(); Will return the hash number of the material hit. You can then check against these values. https://pastebin.com/gyHjsYBK They might have changed however. You can hunt for them in the game files. You might also get away with using mp.game.joaat("concrete_pothole") or mp.game.gameplay.getHashKey("concrete_pothole") for example and see which one is valid. In the next update you can use this set. Which will return a hash number again but isn't dependent on an entity. Then you compare the result against the list again. mp.game.worldprobe.castRayPointToPoint mp.game.worldprobe.getShapeTestResultEx However if you're willing to experiment and try to duplicate the raycast process. You can try spawning an invisible object at the designated location (use mp.raycasting.testPointToPoint and get the hit coordinates) and then using getLastMaterialHitBy() on that object. This might work but I'm not sure. Vehicle.getLastMaterialHitBy() always returns 0. Why? Link to comment Share on other sites More sharing options...
notsosmart Posted August 27, 2018 Share Posted August 27, 2018 On 8/22/2018 at 10:32 AM, linnik said: Vehicle.getLastMaterialHitBy() always returns 0. Why? Use the native version then. mp.game.invoke("0x5C3D0A935F535C4C", vehicle.handle); Link to comment Share on other sites More sharing options...
linnik Posted August 27, 2018 Author Share Posted August 27, 2018 1 час назад, notsosmart сказал: Use the native version then. mp.game.invoke("0x5C3D0A935F535C4C", vehicle.handle); It doesn't work for ground surface but works only when car hits something with it's body. Link to comment Share on other sites More sharing options...
notsosmart Posted August 27, 2018 Share Posted August 27, 2018 59 minutes ago, linnik said: It doesn't work for ground surface but works only when car hits something with it's body. Then wait for the 0.4 update which allows you to use custom raycasts. 1 Link to comment Share on other sites More sharing options...
Ownness Posted February 14, 2023 Share Posted February 14, 2023 can someone give a list of hashes of materials? Link to comment Share on other sites More sharing options...
Ownness Posted February 14, 2023 Share Posted February 14, 2023 resolved Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now