Jump to content

Colshape Hit Detection


Bonsai

Recommended Posts

Posted

Hey Peeps,

I was playing around with colshapes, and I noticed colshapes only seem to detect hits, if the center of an element enters it.

Like, if you drive in a colshape, and only the first part of the vehicle is inside, the hit won't be detected.

Is there some way to make it detect even a slight hit?

Bonsai

Posted

I assume that if you compare 3D positions between that collision shape and the vehicle's collision shape (see getElementColShape), that'd work. I wouldn't trust isElementWithinColShape to check if it's actually within the collision shape because it most likely also works the way you described above.

I used to know how to code, but then I took an arrow in the knee.

Project Redivivus - Remaking Old School MTA With New Code

MTA 0.6 Nightly 1 released

Posted

I think you get it all wrong, it's something that has been made by GTA ( or MTA, not sure. I guess they didn't change this! ). The models of a vehicle isn't getting touched by an element ( not the 'bounding box' ). The thing that is being hit is the center of a vehicle. The player is there, so once the player hits the vehicle hits the colshape. There are some work-arounds for that. But tbh, it's not worth to make. Takes quite some time and is overrated. What are you trying to do anyway?

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...