Author Topic: Rigidbody in Panels  (Read 4879 times)

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Rigidbody in Panels
« on: December 11, 2013, 10:16:16 PM »
Hello,

I understand why you had rigidbodies attached to panels, they certainly do reduce the static collider calculation on move and at certain times we do have buttons moving around... BUT, the rigidbody also unifies the colliders as "one body"... its not really a merge but they count as one for collisions...

I've commented out the part of the code that adds the rigidbody, and I dont know if there is a real solution to the static collider problem, but I have a custom input script more suited for my needs and I just cant have that rigidbody there, unfortunately.

I would suggest making a bool on the panel script to add or not a rigidbody... i know it is pretty easy to just go there and comment the code, obviously, but I suppose I will have to do that in every release, and I am sure there are more people with this kind of problem other then me. Actually, is that the reason you've added the rigidbody in the first place, for the static collider move overhead?

Best regards,
Allan

wangzy_88

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 33
    • View Profile
Re: Rigidbody in Panels
« Reply #1 on: December 11, 2013, 10:24:33 PM »
And everytime press "Apply",the prefab will add a rigidbody.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Rigidbody in Panels
« Reply #2 on: December 12, 2013, 12:22:11 AM »
Ideally you should modify the physics collision matrix so that there are no collisions with the UI layer at all.

I can certainly make this an option that defaults to 'true' though.

schwarzenego

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: Rigidbody in Panels
« Reply #3 on: December 12, 2013, 07:45:44 AM »
I do change the matrix to make sure there are no collisions, to be honest all my ui colliders are triggers, but actually I did a quick search now since I had honestly never thought of that... and for my Input class I use raycasts to check if I did touch or not on something (I think there is no other way really) but with the rigidbody I was constantly getting hit information on the Panel and not the buttom I tried hitting... but if I check for hit.COLLIDER.transform (instead of only hit.transform)... that is the real deal...

So in the end, the kinematic rigidbody seems to be a good idea =)

Thanks for the answers tho!