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 / Kinematic Sprite Collision

Author
Message
Shokkul
8
Years of Service
User Offline
Joined: 30th Oct 2015
Location:
Posted: 1st Oct 2016 16:37
Hello guys,
I am currently making a game like megaman. I implemented all the game mechanics (gravity, jumping, shooting, enemies, animations etc) however there is a problem. When I assign my main character's fire (projectile) physics into kinematic and when I use GetSpriteFirstContact() I can't detect any collision. However if I assign it's physics to dynamic it works perfectly. But If I assign projectile sprite to dynamic, projectiles don't pass through walls. What can I do for this situation? How can I check the collision of sprites that have kinematic physics?
Thank you.
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 1st Oct 2016 17:42
You could use Sprite groups, but an easier method would be to make you projectiles a sensor... This allows collision detection, but also allows them to pass through other physic sprites...

SetSpritePhysicsIsSensor()
Using AppGameKit V2 Tier 1
Shokkul
8
Years of Service
User Offline
Joined: 30th Oct 2015
Location:
Posted: 1st Oct 2016 17:56
Thank you so much, it helped a lot. But still I need to use it with dynamic physics. Now projectiles can pass through walls but they don't go straight because I have gravity in the game.
Shokkul
8
Years of Service
User Offline
Joined: 30th Oct 2015
Location:
Posted: 1st Oct 2016 18:20
Bump for changing to question,
Now projectiles pass through objects with SetSpritePhysicsIsSensor() even though their physics are dynamic, how can I close gravity for spesific sprite with physics?
Thanks
Shokkul
8
Years of Service
User Offline
Joined: 30th Oct 2015
Location:
Posted: 2nd Oct 2016 13:57
Solved the problem by using SetSpritePhysicsForce().

Login to post a reply

Server time is: 2024-03-28 09:57:42
Your offset time is: 2024-03-28 09:57:42