playMaker

Author Topic: Mouse Over / Collision Detection Problem  (Read 3663 times)

bobbykarate

  • Playmaker Newbie
  • *
  • Posts: 15
Mouse Over / Collision Detection Problem
« on: May 20, 2013, 04:02:31 AM »
I'm new to all this but trying to learn. I've attached an image to illustrate my issue. I can't seem to figure out whats going on here.

Basically I'm wanting to use ngui and playmaker to build a ui. I just want this ngui created sprite to scale up when I mouse over it. I add collision to the sprite object, add an fsm telling it to change scale when its moused over. but the collision detected in game doesnt match with the collision viewed in the viewport.

I'm probably doing something stupid or missing something so basic. please any help would be greatly appreciated. I'm less interested in other ways to achieve this and more interested in understanding the problem.

bobbykarate

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Mouse Over / Collision Detection Problem
« Reply #1 on: May 20, 2013, 04:09:58 AM »
Okay so I realized the detection is occurring on the actual black bar object in the scene rather than the one drawing on the screen from the ui camera. How do I fix this? I noticed this when I changed the main camera culling mask so it could draw everything. This seems like an easy fix and I'm just missing something basic.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mouse Over / Collision Detection Problem
« Reply #2 on: May 20, 2013, 06:02:15 AM »
Hi,

 Ngui comes with everything you need to do that without any work on your end. Have you checked the samples provided by Ngui, almost all buttons have scaling behaviors. Basically, you can configure the way it scales and when pretty much to achieve anything.

 Have a closer look.

It may simply be an issue with z ordering, try to move the Ngui plane in front ( modifying the z value of the transform), editing the z index might also be an idea if it's blocked by other ngui components.

 Bye,

 Jena

bobbykarate

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Mouse Over / Collision Detection Problem
« Reply #3 on: May 20, 2013, 01:01:35 PM »
Hi,

 Ngui comes with everything you need to do that without any work on your end. Have you checked the samples provided by Ngui, almost all buttons have scaling behaviors. Basically, you can configure the way it scales and when pretty much to achieve anything.


In this case I'm not using 'buttons' rather I'm trying to use a sprite. Maybe Sprites don't carry their collision over to screen-space? Seems like they should though I obviously don't know how that works. I assumed any object with a collider should work the same regardless of other components. Again I'm not trying to find another way to achieve this, I'm trying to understand the problem.

I add a sprite to my ngui panel, add collision to sprite, add events when sprite object is moused over. But only the actual object in the scene displays recognition, and the object being rendered from my ui camera does not recognize any collision detection. So what's the disconnect? all of thenui elements are tiny and at 0x0x0. so all my collision detection takes place at 0x0x0x instead of in screespace where the ui draws and will be interacted with.... I'm missing something very fundamental here... any help please!?

bobbykarate

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Mouse Over / Collision Detection Problem
« Reply #4 on: May 20, 2013, 05:28:41 PM »
I think my problem isn't with playmaker at all actually. I think it's with ngui. I tried building the ui in 3d as a hud attached to the player camera instead (its a first person camera). Still using a ui camera, but now the world geometry collision is detected instead of the hud geometry if the world geometry is in between the hud and the player camera...

So I think my real misunderstanding is how to properly setup the ui camera in conjunction with a first person camera.