Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / ObjectRayCast & optimization

Author
Message
Santiago3D
4
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 2nd Jun 2020 17:38 Edited at: 2nd Jun 2020 17:42
Hello how are you?

I make a query regarding performance.

I have my ammunition, many ammunition !!,

I am generating a fall of FPS to calculate if they are colliding with something.


It would be ideal to be able to say that it only checks if it is colliding with objects that are only visible to ammunition.

For example, an anti-aircraft munition that fires a ship, I'm only interested in knowing if it collides with certain planes that are in a small area.

But I can't find how to generate a system so that ObjectRayCast can only calculate collisions with a small number of selected objects.



IMPORTANT : I use a very lowpoly object to detect collisions, that lowpoly object represent my highpoly aircraft or ship.




part of my code to check the collisions of munition over objects


fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 2nd Jun 2020 18:15 Edited at: 2nd Jun 2020 19:45
the simplest way ive found to detect a collision between two object with raycasts returns 1 if true


or change this for any object returns the id of the collision object


but you may be able to simplify this cast for bullets for example using a heliobject I did in another game

edit when hit was greater than 0 there was a hit

not sure how you do your distance checking but agk has some great math functions at our fingertips I have this function

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk

Login to post a reply

Server time is: 2024-11-22 04:45:14
Your offset time is: 2024-11-22 04:45:14