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 / ObjectSphereCast() with multiple objects?

Author
Message
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 5th Jun 2017 04:40
Is it possible to use ObjectSphereCast() with multiple objects?

ObjectSphereCast( objID, oldx, oldy, oldz, newx, newy, newz, radius )

To clarify, I mean the "objID" part.

I don't want to use "0" (zero), I want to test against specific objects.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 5th Jun 2017 09:06
You could maybe use physics groups?
Signature removed by mod because it's larger than 600x120... please resize and try again.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 5th Jun 2017 09:26
You have to loop through your collisions affecting a new position to old, old, oldz with the last collision point. Or make the last collided object temporary invisible once the loop is finished .
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Jun 2017 09:28
i believe ray cast testing only objects where
SetObjectCollisionMode
is on

or maybe you can use an object list array and test exclusive each objID.
https://www.appgamekit.com/documentation/guides/12_array_changes.htm
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 5th Jun 2017 09:48
Yes sorry. Make the collision mode to zero (and not invisible).

I have a sample function I will provide when I will be able to access a computer (in few minutes!)
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 5th Jun 2017 10:13 Edited at: 5th Jun 2017 10:14
Here is an old code (you can optimize it return the array directly instead of using a global with the new array functions !) :
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 9th Jun 2017 07:41 Edited at: 9th Jun 2017 07:43
Thanks for all the ideas.

Currently all the collision objects are in an array, the code loops through and checks each. But, this can cause issues. All the meshes need be checked at the same time, not one by one.

I'm trying to figure about a way to use 0 (zero) (all meshes). But, can't seem to make it work. There is just too much going on in the game. Also the player's own hitbox gets in the way... suppose I could disable it right before checking. This is getting messy..

Do physics groups work with collision detection?
Thought they were for 3D physics only.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Jun 2017 08:15
if you have more than you want in the result,
why not remove it from result list.
you can so this in a sub routine giving your lists there by referecne.
index = myArray.find(hitbox)
if index=>0 then myArray.remove(index)
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 9th Jun 2017 20:02 Edited at: 9th Jun 2017 22:31
Okay, I realize the way I'm trying to explain this is unclear at best. I'll show rather than tell.

While testing ObjectSphereCast() with 0 (zero) rather than an objID. I ran into some inconsistent behavior.
The collision works as desired with a specified objID, but is glitchy with 0 (zero).

Attached is a very watered down version of the game.
If you can ignore the mess of code, the collision stuff is marked with:


[Attachment Removed]

Attachments

Login to view attachments
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 9th Jun 2017 21:37 Edited at: 9th Jun 2017 22:30
I've just made the map.collision and hitboxes taller. It appears to have resolved the glitchy-ness.
Still strange that it behaves differently..

It's looking like this could work with 0 (zero).

[Attachment Removed]

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-17 20:56:47
Your offset time is: 2024-11-17 20:56:47