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 / It seems like GetSpriteFirstContact doesn't work reliably on my end (2.0.20 Tier 1)

Author
Message
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 2nd Sep 2016 22:23 Edited at: 2nd Sep 2016 22:34
Hi guys !

I have a gun shooting a projectile on a moving target. Everthing is physics based. The projectile is set as a bullet (with setspritephysicsisbullet). It's initial velocity is set with SetSpritePhysicsVelocity and is around 300 per frame. The target has a max velocity of 120. I have this code running every frame for every bullet just before the sync() :





The code runs at 59.99 frame per second. 19 times out of 20, the bullet disappears as it should. But the rest of the time, the bullet bounces and doesn't disappear. The bullet bounces more often when the target and the bullet go in the same direction. What could be the issue ? Are my sprites moving too fast ?
TDavid
11
Years of Service
User Offline
Joined: 7th Feb 2013
Location:
Posted: 2nd Sep 2016 23:32
I couldn't fix this issue but I've found a workaround. I compare the initial velocity of the bullet to its velocity in flight every frame and delete it when there's a difference (if the velocity changes, it means that the bullet bounced on the target).

I ran into another problem if you're interested to help, I created another thread about GetSpritePhysicsVelocityX()

Login to post a reply

Server time is: 2024-11-25 03:30:08
Your offset time is: 2024-11-25 03:30:08