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 / Need Help Enemy Collision

Years of Service
User Offline
Joined: 9th Jul 2012
Posted: 11th Jul 2012 21:50
Hello all, TGC friends, I am making a 3D game...for now each and everything is going good in it, today i start working to add some enemies in my game... i am using Sparky's Collision Library, my player is colliding with the level, but i am confuse about how to add Collisions for enemies... do i have to write sphere casting function for each and every enemy??? if yes then how? please help me

G!rLz CaN C0d3 GaM3s....!!!!
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 12th Jul 2012 18:23
The first thing you need to consider when using Sparky's collision system is that you cannot detect collisions between two polygon or complex collision bodies. I usually use box collision for characters and complex / polygon for static objects in the game world.

As for detecting collisions with moving entities (ie. enemies), it was a while since I last used Sparky's, but I think that's when you want to use the collision groups. You can set a certain group for each collision body when you create it and then use for example sc_sphereCastGroup to check for collisions against any of the objects in that particular group. There should also be a function for retrieving the object (if any) that the collision took place with, although its name eludes me at the moment. It might be the return of the group collision checking functions, but there are ways to retrieve a list of all objects you are colliding with as well, in case there are more than one or zero.

"Why do programmers get Halloween and Christmas mixed up?"

Login to post a reply

Server time is: 2020-02-16 23:26:33
Your offset time is: 2020-02-16 23:26:33