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 / GetPhysicsCollision( Sprite1, Sprite2 ) doesn't work

Author
Message
Juergen
15
Years of Service
User Offline
Joined: 14th Dec 2008
Location: Germany
Posted: 9th Feb 2013 18:24
GetPhysicsCollision( Sprite1, Sprite2 ) doesn't work, and i dont know wy
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 9th Feb 2013 18:34
It would probably be easier for us to help you if you post some code so we can tell if you have made any misstakes.
Juergen
15
Years of Service
User Offline
Joined: 14th Dec 2008
Location: Germany
Posted: 10th Feb 2013 10:20
Hello Zoq2,

here some code



The Backvalue is always 0
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 10th Feb 2013 16:59
And please tell us what version of AppGameKit you are using.

Also, how are you deciding that GetPhysicsCollision not working?

From your GameUpdateBall function, you are both manually setting the ball sprite and then trying to apply an impulse to it.

The two don't work together. Either you totally control the position of the sprite (not using impulse or force) or you let the physics engine handle all of it (not using setspriteposition).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Juergen
15
Years of Service
User Offline
Joined: 14th Dec 2008
Location: Germany
Posted: 11th Feb 2013 17:29
Ok,
the version is 1088, not the GetPhysicsCollision works I simply determined by which I have to print the return value and the display was also absolutely unique collision of two dynamic or dynamic and static sprites always 0. SetSpritePhysicsImpulse works absolutely perfectly and the way I though as I used there. When I program the collision detection with a few if's even it works so well.
Juergen
15
Years of Service
User Offline
Joined: 14th Dec 2008
Location: Germany
Posted: 12th Feb 2013 19:10
Well, I have solved my problem itself,
you must simply call GetPhysicsCollision before SetSpritePosistion. Then everything works as I programmed it.
Is maybe even a tip for others
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 12th Feb 2013 19:15
That makes perfect sense (now that I think about it).

Because it is entirely possible that the sequence is resetting the sprite position first, which clears the collision information.

The physics processes won't update immediately upon doing things. All actions and checks take place when the sync() command is called.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 12th Feb 2013 19:47 Edited at: 12th Feb 2013 19:50
Quote: "Is maybe even a tip for others "


That is actually a great tip, because I have heard it over and over that SetSpritePosition does not work with GetPhysicsCollision, and now you proved everyone wrong.

I vote that this tip be added to the documentation page for both commands.

Thanks and cheers,
AgentSam
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Feb 2013 21:19
I agree AS, that's very important information. I wasn't aware there was an issue but maybe I have been using the commands in the right order purely by chance up until now.


this.mess = abs(sin(times#))

Login to post a reply

Server time is: 2024-11-24 07:37:53
Your offset time is: 2024-11-24 07:37:53