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

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

PAIV IS COMIN'
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
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: 2024-03-29 10:03:54
Your offset time is: 2024-03-29 10:03:54