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.

Dark GDK / Sparky Collision CRASH Help!

Author
Message
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 23rd Feb 2011 02:35
Hi all... I posted a thread about a different Sparky issue, but this time it's even worse!

Whenever I try to use SC_ObjectCollision the game just freezes up when I crash. It seems that probably SC_ObjectCollision returns something different than SC_SphereCast, or something else. Either way, here's my code. I hope someone will help me.

Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 23rd Feb 2011 21:18 Edited at: 23rd Feb 2011 21:18
I'm not very practiced with Sparky's either but I see a few problems here. First, object collision checks if two objects are currently intersecting with each other. With the sphere cast command, you can give start and end position of the planned movement, so you can avoid collision before it even happens. But with object collision, only current position can be checked. In your function you calculate the planned new position of the object, but do not really position it until the end of the function. Therefore the collision check will see the object in the old position and check that. If the new position is not OK, it will not notice and the object will move into collision. The proper usage would be: store old position, move (position) the object, check collision, then if it collides, move back to the old position.

The second problem is that you try to get GetCollisionBounceX/Y values after object collision. Sparky's help clearly says that object collision does not provide any additional information, so calling these functions is an error in this case.

Finally, in the "if collide" check, you update the movement vector with the bounce values, but you never adjust the planned x,y values. Even if the bounce values are valid and the movement vector is adjusted correctly, the object is still positioned into x,y coordinates which are in collision. I think that you should somehow update the x,y values as well, not only the movement vector, if a collision is detected.
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 25th Feb 2011 00:45
Thank you for your insight. I'll be reading this post very closely to help solve my code.

Login to post a reply

Server time is: 2024-11-19 12:20:41
Your offset time is: 2024-11-19 12:20:41