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 / sparkys collision

Author
Message
Wikaman1
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location: Scotland
Posted: 20th Sep 2008 11:16
I just got sparkys collision but i'm having some problems. I've managed to set up objects for collision for bullet holes ect. but you can walk right through the building in my game. What is the best way to create collision for houses and other buildings? Thanks
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 22nd Sep 2008 07:30
First you need to detect for the collision, which is what sparky's does for you..

After you have detected that a collision has occured, you need to handle it, which means having some code to stop movement when a collision occurs(ideally check if movement will result in collision(probaby a ray casting check), if it does, stop movement)...

As for the "type" of collision to use, I think sparky's uses bounding box, spherical and polygonal detection.... the type of collision detection that you would use would depend on a couple of things... the complexity of the geometry that you are detecting collision against, how accurate those collisions need to be etc.. If you have very complex large geometry that forms "multiple convex" shapes, probably using polygonal detection would be best, wheras if your geometry was smaller and/or simpler, like tree trunks or furniture in a house, you could use bounding box style collision detection, which is more efficient than polygonal detection(just not as accurate)

Once you get some basic collision handling code setup, I suggest that you maybe do some experiments with how the different types of collision detection work with different kinds of geometry...ie, setup a heap of different geometry, from simple primitives to complex models, small(small furniture) to large(house+ size), set them all bounding box, then all polygonal, and check out how the differences affect your program and how the collision "looks" using the different detection types ..For example having a complex "convex" object, like an L shaped building, and detecting its collision using a bounding box, might result in the collision not looking correct, as a bounding box is a box(6 sides, 90deg angles etc) it cant contain an L shape properly and would look like part of the area where you should be able to go wouldnt be accessible( invisible walls, which could be bad if that was where the door to the building was!! ), wheras polygonal detection would use the actual object's own polygons(as opposed to its surrounding bounding box) for its detection so would allow moving into and out of the more complex parts of the geometry.

Good Luck, in my opinion Sparky's is a great library to use, very powerful, yet simple too...

If it ain't broke.... DONT FIX IT !!!

Login to post a reply

Server time is: 2024-09-30 07:27:38
Your offset time is: 2024-09-30 07:27:38