3D model hit detection

Started by Pfaber11, April 04, 2021, 13:32:30

Previous topic - Next topic

Pfaber11

Hi been using 3D wings to make my models . I'm having a problem in that when I shoot one of the enemy I have to hit it straight in the middle to register a hit . I want to be able to hit it anywhere to register a hit . Any help would be good . I have had it working the way it should but for some reason cannot replicate it.   
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Dabz

Try replacing your mesh with just a standard cube and see what happens, and/or, use your mesh with the collision example code{s} in the command help.

If you get the same result with the standard cube, your code is wrong, and, well, use the example code because it's how you do it... If your mesh does the same with the example code, then there is something wrong with your mesh.

Prod and poke, thats all you can do, without anything to look at or try, its guess work.

Dabz

Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

iWasAdam

the key is your hit detection is separate from the 3d display. you can use simple basic hit detection on rects and then transfer the result to your 3d :)

Pfaber11

Thanks for the advice gonna try the cube idea and go from there .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Pfaber11

HI sorted it and it was a case of my projectiles moving too fast . Slowed them down to 60 units a frame and all better . I was going at 600 or even 1000 units per cycle and although it was like a machine gun it would only register a hit if hit dead center. Used the cube idea and it was doing the same . Anyway thanks for the suggestions . Have a nice evening .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Dabz

Ah good... I thought it might be code, but I'm on the understanding AGK doesn't acknowledge backfaces when it comes to collisions, not that I'm a expert on 3D stuff, which I'm definitely not, but, you never know, something could of gone squiffy on the export, so worth the check.

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

blinkok

You might want to look into the raycast functions

Dabz

#7
Quote
You might want to look into the raycast functions

Thats what I was presuming he was using, but depending on how the functions are used, there is still the possibility a certain sized ray check can go through an object without colliding, based on the velocity and the XYZ's given.

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Pfaber11

#8
Yes am using the raycast method . Finished my game off in studio which I rate quite highly . Thanks for the help and suggestions . The Raycast stuff used to scare me but not anymore . Not nearly as bad as it sounds once you get into it and have a play . Taken down a few of my earlier games off the internet as were really rubbish but which I thought were ok at the time .  Enjoy your day.
Forgot to mention I am now using my projectile speed at 120 units per cycle and it works fine at this speed and is just right .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz