Author Topic: UIViewport & collisions problem  (Read 4738 times)

joreldraw

  • Guest
UIViewport & collisions problem
« on: October 09, 2012, 01:17:59 PM »
Hi.

Im again with my draggable panel with 3d objects.
Now i use a 3d camera with the UIViewport how you recomend me.

But now im having an issue.

When i drag the object, apparently everything works fine.
But when i click on an object, not work. I need to click in her original position.
I think that is a kind of update problem.

I check gizmos and collidesr move with the objects right, but is how a gosth the action of this colliders, ever in the same position. Out of the objects when drag...

My hierachy is a Root with the 3d Cam and the 3d elements and with UIViewport linked to another 2d cam in another root with my UI Bg and draggable panel.

Any solution?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIViewport & collisions problem
« Reply #1 on: October 09, 2012, 05:25:48 PM »
"but is how a gosth the action of this colliders" -- what?

joreldraw

  • Guest
Re: UIViewport & collisions problem
« Reply #2 on: October 10, 2012, 01:59:48 AM »
The click event not is efective where really is the collider.
This is effective in her original position before Dragg the panel

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIViewport & collisions problem
« Reply #3 on: October 10, 2012, 03:09:57 AM »
Double check the size and position of the colliders. For example if you have a 2D camera with the near clipping of 0 and far of 10, any collider placed at the Z of 0 may or may not receive an event. Likewise if you resized some widget, make sure to update its collider as the two are not related.

joreldraw

  • Guest
Re: UIViewport & collisions problem
« Reply #4 on: October 10, 2012, 03:55:42 AM »
Not work.
If i drag the panels, imagine that collider dont move, but the object move.

I need to click on old collider position to work.

How can the UiVeiwport refresh and repositione the colliders ?

joreldraw

  • Guest
Re: UIViewport & collisions problem
« Reply #5 on: October 10, 2012, 04:15:10 AM »
Well, i test so much and the collider position move when drag.
The issue is so strangle.

I solved it moving the collider in X her  X size, is how internally the collider displace to left her size and go out of the object.

joreldraw

  • Guest
Re: UIViewport & collisions problem
« Reply #6 on: October 10, 2012, 04:31:43 AM »
Not fully resolved.
The problem is related with field of view of the 3d camera.

If i change this, the collider go back again to another position...

This problem can be related too with 3d cam, if i change to ortographic all work fine.
« Last Edit: October 10, 2012, 04:57:53 AM by joreldraw »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIViewport & collisions problem
« Reply #7 on: October 10, 2012, 09:31:17 AM »
3D UI's widget position should match your colliders assuming you updated the colliders (NGUI menu -> Add Collider) after moving the widgets around.

joreldraw

  • Guest
Re: UIViewport & collisions problem
« Reply #8 on: October 10, 2012, 01:46:36 PM »
For 3d ui you tell me i need to do:

1.- Move the 3d object
2.- Attach a new collider on the new position?

When i drag the panel i make this in each frame render?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIViewport & collisions problem
« Reply #9 on: October 11, 2012, 04:42:47 AM »
Depends on your setup. If you have a button for example, moving its background (which is a child), would cause the collider to no longer match what's there. Selecting the collider and doing Add Collider via the menu updates it properly.