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.

DarkBASIC Discussion / Rotate collision box

Years of Service
User Offline
Joined: 12th Oct 2011
Posted: 6th Sep 2012 23:39
Is there any way to rotate an object collision box?

Years of Service
User Offline
Joined: 23rd Jul 2006
Posted: 7th Sep 2012 11:00
You can rotate the object collision box with the object if you set the rotation flag:

Enjoy your day.
Fluffy Rabbit
User Banned
Posted: 7th Sep 2012 15:06 Edited at: 7th Sep 2012 15:29
Yes, that is how one would rotate a collision box, technically, but with such a basic question I can only assume that nightowler isn't all that familiar with DarkBASIC's collision system. DarkBASIC's built-in sliding collision functions only work with non-rotated collision boxes. For high quality sliding collisions against complex objects, I would recommend the use of the ColDet library, which I used for the collisions in Dark Survival 2. However, I predict that it would probably take you a long time to adapt DS2's collision routines into your game, and even longer to make them from scratch using ColDet. In that case, there is a commonly-used method that does not involve such complex code. It involves the use of a non-rotated box for the player's collisions and 3 calls to object collision() per loop, one for each axis. The July release of the Dark Survival 2 demo used that method 2-dimensionally. Here is an applied example of the key parts of the collisions used there:

Login to post a reply

Server time is: 2020-08-05 02:48:25
Your offset time is: 2020-08-05 02:48:25