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 Collisions Not Working?

Author
Message
BitManip
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Essex
Posted: 26th Jan 2019 16:58
Hi All, thanks in advance!

After a looooong time away from coding I thought I would get back it AppGameKit and c++ again! So quickly got the template to compile etc but testing very simple physics collisions (of 2d sprites) and the collision seems not to trigger?





The bounding box collisions registers, but the physics ones do not?

As the above did not work, I moved to basic Script to check and this does not work:


What Am I missing?

Am I missing something?
I control all the juicy in here!
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 26th Jan 2019 20:30 Edited at: 26th Jan 2019 20:33
you're using static collision, you need to use dynamic for moving objects (mode 2)
also if you're going to use the physics you shouldn't use SetSpritePosition for updating the physics, use the engines physics commands (such as SetSpritePhysicsForce)
life's one big game
spec= i5 4ghz, 16gb ram, Nvidia 1070ti gpu
BitManip
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Essex
Posted: 26th Jan 2019 21:01
Smallg
Thanks for the reply.

I get what you are saying, but i have tried changing the physics mode to all variations to mo avail.

I understand that manually moving the sprites counteracts box2d’s system, however in the past the collisions would still register.

Any other ideas?
I control all the juicy in here!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 26th Jan 2019 21:10 Edited at: 26th Jan 2019 21:11
if you remove SetSpritePosition() then it works.
Just because an unsupported feature has worked in the past is no guarantee that it will work with the later versions
You could turn physics off and use GetSpriteHitTest()
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th Jan 2019 00:03 Edited at: 27th Jan 2019 00:04
If you use dynamic sprites you have to use the inbuilt move commands or the physics collision will still be where they was when you first declared them
if you use static and move them that will also be an issue
there are two alternatives you can use kinematic physics which allow you to move them but its experimental
the other alternative is if for example you use static objects everytime you want to move them you have to delete the physics part then move the sprite then
set up physics collisions again

That's how it works in 3D and im quite sure it works the same way in 2D
fubar

Login to post a reply

Server time is: 2024-10-01 01:20:03
Your offset time is: 2024-10-01 01:20:03