magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Mar 17, 2016 17:34:48 GMT
I'm reading the documentation to understand the system better and trying to find out if I should be using Killables. The first thing I noticed that is very strange is the following text in the documentation:
"And *at least one* of the object's Rigidbody need to be "gravity"."
I also found a post somewhere in these forums that says that it's a Unity requirement to have gravity enable for collisions to work. OK, so I'm not exactly a Unity expert, but I've been working on several projects in which I have collisions working just fine and no gravity for any of the rigidbodies. I use OnTriggerEnter and have the colliders checked as Is Trigger. Then I thought maybe you are using OnCollisionEnter and that must have this requirement. But I ran a test with 2 objects that have Rigidbody and BoxCollider and Is Trigger set to false. Without Gravity being set for either, the OnCollisionEnter still fires. If they are set to Is Trigger then it doesn't fire, but not because of Gravity because it still doesn't work even when Gravity is on.
So, can you explain this Gravity requirement to me? What is the situation that requires Gravity being checked? I mainly ask because I'd rather not have gravity turned on for any objects if it's not really needed.
|
|
|
Post by DarkTonic Dev on Mar 17, 2016 19:30:18 GMT
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Mar 17, 2016 19:37:23 GMT
I'm not 100% sure as there might be some crazy combination of things that make it required and you may have that scenario. I just know I never had to have it when using OnTriggerEntered and in my limited test just today I didn't need it for OnCollisionEnter either. Although, having both of these work together is a bit tricky and maybe there's some reaosn why it's needed when they are used together. I would definitely like to know definitively though. It would be nice not to have Gravity checked when I don't need it.
|
|
|
Post by DarkTonic Dev on Mar 17, 2016 19:41:32 GMT
Ok, it definitely will work with gravity on, so for now that's still the recommended scenario until I receive "semi-official information" to the contrary. Lots of people have had problems with collisions / triggers working before and asked us. That's why I put that information in the readme.
To be on the safe side, I would set it up as we advise, and once you see it's working fine (there can be other problems with Killables on occasion such as the renderer, turning on Logging will let you know), try turning off gravity and see if it still works.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Mar 17, 2016 19:50:39 GMT
Ok, it definitely will work with gravity on, so for now that's still the recommended scenario until I receive "semi-official information" to the contrary. Lots of people have had problems with collisions / triggers working before and asked us. That's why I put that information in the readme. To be on the safe side, I would set it up as we advise, and once you see it's working fine (there can be other problems with Killables on occasion such as the renderer, turning on Logging will let you know), try turning off gravity and see if it still works. I'm still not sure I need Killables. But I'll read some more and look at the examples as well as trying it out to see what benefit it gives me. Since I'm porting over a game that already has a system in place for pooling, spawning, and killable enemies it's a matter of whether or not I should stick with what I already have on some things or convert to CGK on everything.
|
|
|
Post by DarkTonic Dev on Mar 17, 2016 19:57:33 GMT
Ok. Killables is a huge part of what makes CGK powerful. But you can just use what you need, which is the beauty of the system. If you need pushback, automatic World Variable modification on destruction (score, XP, etc) or any of the other myriad of Killable functions, it may be a no brainer.
If you have something on your old system that Killable doesn't, let me know and we'll see if it can be added. The collisions and triggers will work as before though, don't worry about that.
|
|
|
Post by DarkTonic Dev on Mar 18, 2016 6:08:52 GMT
The information I had was either outdated or wrong. What people are saying now: for a collision both need colliders. At least one needs a rigidbody. No gravity requirement. I have updated the documentation.
Thank you for bringing this into question!
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Mar 18, 2016 13:22:15 GMT
No problem. Thanks for investigating further to get the answer.
|
|
|
Post by DarkTonic Dev on Mar 18, 2016 15:27:57 GMT
Sure thing
|
|