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 / physics objects,

Author
Message
Zubby1970
AGK Backer
16
Years of Service
User Offline
Joined: 22nd May 2008
Playing: AGK Studio Always
Posted: 28th Aug 2012 01:35
i want certain physics object to collide with each other but not others, its for ragdoll so the whole ragdoll rig wants to ignore each other but not objects around it.

Ive been trying to use setsprite group and setspritecollidebits

but it does not seem to work.

for n=80 to 85
setspritephysicson(n,2)
next n

for n=80 to 85
setspritegroup(n,16)
setspritecollidebit(n,16,0)
next n

am i doing it right.

There can only be one
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Aug 2012 09:30
I'm afraid it doesn't work like that. All dynamic objects can collide with each other unless they are connected using a joint. The best way to achieve the same effect is to have minimal 'shapes' for each body part so that the images can overlap as they should.


this.mess = abs(sin(times#))
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th Aug 2012 16:13
@baxslash, not quite true.

You can use SetSpritCategoryBits and SetSpriteCollideBits to restrict interaction. I use this very successfully.

You have a total of 16 categories, but you don't use the values 1 through 16. You use a bit mask, 0x0001, 0x0002, etc. to set discreet categories. If you want to allow more than one category, use values like 0x0003 to match categories 1 and 2.

Cheers,
Ancient Lady
AGK Community Tester
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Aug 2012 16:17
You learn something every day

That simplifies things a little, shame it's not more obvious though, I thought that was for multiple shapes within a single object for some reason. Well that will certainly make ragdolls a little easier. Maybe a few commands for setting interaction between collision groups would be handy... I may have to add that to my library.

I might be inclined to set up collision between the setSpriteGroup "groups" using a few functions.


this.mess = abs(sin(times#))
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 28th Aug 2012 21:09
SetSpriteGroup

Description

Assigns this sprite to a group for filtering collisions (physics or non physics). In physics, sprites of the same positive group ID will always collide, whilst those that share the same negative group ID will never collide. Those with a group ID of zero (default), or differing group IDs move on to the category filter check.

I simply have my player have group -1 and the same for the sprites it shouldt collide with.

Works for me.

Android 2.3 Gingerbread , ZTE Skate , 480x800 , 800 mhz cpu , Samsung Galaxy Y , 240x320 , 832 mhz cpu
Android 4.0 Sandwich , Dmtech 3g 9738B , 1024x768 , 9.7 inches , cortex A8 1.2 cpu , 1 gb ram.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Aug 2012 21:22
Nice I love this community.

I might have found that out if I ever needed it but it's good to know there are several ways to skin this particular cat


this.mess = abs(sin(times#))
Zubby1970
AGK Backer
16
Years of Service
User Offline
Joined: 22nd May 2008
Playing: AGK Studio Always
Posted: 28th Aug 2012 21:40
Thanks guys some food for thought in all this I will have to do some tinkering

There can only be one
Zubby1970
AGK Backer
16
Years of Service
User Offline
Joined: 22nd May 2008
Playing: AGK Studio Always
Posted: 29th Aug 2012 03:39
thanks ancient lady once i got a gist of those masks mission accomplished i now have a much improved ragdoll physics going on, had to go rummage through my code what a nightmare but its done now.

thank you very much for the tip.

There can only be one
Zubby1970
AGK Backer
16
Years of Service
User Offline
Joined: 22nd May 2008
Playing: AGK Studio Always
Posted: 29th Aug 2012 03:39
ill release a video in work in progress very soon.

There can only be one
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th Aug 2012 05:33
Always glad to help.

Happy Programming!

Cheers,
Ancient Lady
AGK Community Tester

Login to post a reply

Server time is: 2024-11-23 21:10:06
Your offset time is: 2024-11-23 21:10:06