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.

Newcomers AppGameKit Corner / [SOLVED] complex collision problem

Author
Message
smerf
14
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 8th Feb 2019 20:54
i have two objects. a dundeon map with doorways and an animated character. I can detect collision between the character and the map. however no matter where I am in the map a doorway or hovering above the ground in a wide-open area is still detects collision when the character does not touch the object. I have tried setting them to static polygons and compound but it doesn't seem to make a difference does anyone know the proper way to set up these two objects.
A child's dream never dies.





The author of this post has marked a post as an answer.

Go to answer

blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 8th Feb 2019 22:42
It's hard to tell what the problem is from your description. A screenshot and code would help a lot
smerf
14
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 9th Feb 2019 05:55
my code doesnt work. I am requesting the correct way to set up a complex static and dynamic body and to detect proper collision between them. an animated character and a simple map with walls. character should have 0 collision when not touching the floor or walls but be within a hypothetical bounds of the map without collision, do they need physics bodys? collision mode? static or dynamic? compound or static ect? or if old xyz ray-casting is required.
A child's dream never dies.





Attachments

Login to view attachments
fubarpk
Moderator
14
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 9th Feb 2019 06:03 Edited at: 9th Feb 2019 06:05
This post has been marked by the post author as the answer.
Quote: "It's hard to tell what the problem is from your description. A screenshot and code would help a lot"

I agree

Don't know your problem but will give some pointers that hopefully may help you or somebody else reading this thread
With physics objects once you have set the collision type you cant use SetObjectPosition to position the object anymore

Static objects never get moved
Kinematic Objects can be moved
Dynamic Objects can be moved but only with the physics movement commands

If you have to move a physics object for some reason reset its position, you have to
first delete that physics object id
then position the object
then you can reset as a physics object

failing to do so the collision boxes wont move with the object

now im not sure what or how you are detecting collisions but here is a function that may help

returns 1 if there is a collision between the two objects

hope that helps if not can you please post some code and perhaps a picture so its easier to help
fubar
fubarpk
Moderator
14
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 9th Feb 2019 06:10 Edited at: 9th Feb 2019 06:12
Another thing to consider is if you are positioning a Dynamic object and perhaps you find it above or not
sitting where you would like the best way to fix this is to centre the pivot point on the object itself.

If you use Blender its the biggest shortcut steps as follows
1>load object
2>select object
3>press shift + ctrl +alt +c
4>select origin to center of mass

don't think that's the problem but thought ide add that for future reference and by the look of the
dungeon it looks awesome so you more than likely know allot more than me modelling

and kinematic objects are very much a trial thing and I haven't had much success with them
fubar
fubarpk
Moderator
14
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 9th Feb 2019 06:22
the walls may not need to be physics objects at all but if you want to do sliding collisions or have objects etc bounce off them
then the walls and floor need to be a static physics body. The gates could also be static physics objects but when you want to
open/close them you need to delete the physicsObject(id) rotate them and then reset the physics object
fubar
smerf
14
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 9th Feb 2019 17:42
so what I gather it is best to stay away from agk collision and just use recasting is that correct? also fubarpk brought up an interesting point that the raycasting might be detecting collision on the y-axis I'll test this later today and post an update
A child's dream never dies.





fubarpk
Moderator
14
Years of Service
Recently Online
Joined: 11th Jan 2005
Location: Adelaide
Posted: 9th Feb 2019 20:24
Quote: "so what I gather it is best to stay away from agk collision and just use recasting is that correct? "

AGK has good collisions but the problem arises when you reposition physics objects that are not meant to be
but theres a way around every problem

Goodluck smerf would love to see perhaps a video or something later of its progress
PS I use OBS studio for recordings its free and my purchased version of fraps stopped working
fubar
smerf
14
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 10th Feb 2019 06:14
Well I used the raycast function in fubarpks above post and removed the y component from it and it works great for detecting collisions on a "flat" complex level. no other commands needed.
Thank you fubark its far from completed or polished but i think its going to be amazing when finished. Later on in the dev i might start a dev stream to make people aware of it so there is an anticipated fanbase before release. got the collision just need point light shadows and ill be good to go lol. I have some plans for faking point light shadows ill most likely implement if i cant find a shader.
A child's dream never dies.





Login to post a reply

Server time is: 2019-10-21 15:43:59
Your offset time is: 2019-10-21 15:43:59