playMaker

Author Topic: Mouse pick event and render texture  (Read 4233 times)

LogLady

  • Full Member
  • ***
  • Posts: 150
Mouse pick event and render texture
« on: January 21, 2019, 08:21:25 PM »
Hi!

I'm using the mouse pick event to activate a text when a trigger is activated. When I'm not using a render texture, the triggers are activated correctly and the text is show as intended. When I add another camera and set it to show a quad where the main camera is rendered, using a render texture, the image is shown correctly but the triggers aren't activated. The render texture is a low resolution texture of the scene and the camera that exhibit it isn't set as "MainCamera". The quad used with the render texture has no collisions.

Is it possible to have this setup and use the "mouse pick event" action to work correctly? It seems that the action is shooting it's rays from the second camera (the one that exhibits the render texture) giving a big offset from the first camera but I want it to shot the raycast from the main camera (as expected).

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mouse pick event and render texture
« Reply #1 on: January 22, 2019, 03:19:51 AM »
Hi,

 you need to resort to manual raycasting and reference the proper camera as mouse pick use the main camera and it looks like your main camera is not showing the exact same view of the world as the other camera that you'd like to mouse pick with.

 you can also swap both camera so that the main camera is the one that you can use mouse pick with.

Bye,

 Jean

LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Mouse pick event and render texture
« Reply #2 on: January 22, 2019, 03:41:29 PM »
Thanks for your reply, Jean! It's good to know that I'm pursuing something doable.

About your reply:

That's exactly what I'm doing. Both cameras are on the exact same position and rotation and I'm pretty sure that the raycast is from the main camera (I'm using the debug line option on the "Mouse Pick Event Custom" action) but I can see on the Scene View that the ray is being shot from the main camera but the position on world is wrong related to the mouse position. When not using the render texture, everything works perfectly.

EDIT: Just to add, the same happens if I use the Raycast action.
« Last Edit: January 22, 2019, 04:03:58 PM by LogLady »

LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Mouse pick event and render texture
« Reply #3 on: January 22, 2019, 07:56:33 PM »
Fixed it!

Sadly I don't know how...

I got tired and created a new project and did everything from scratch and everything worked fine. I compared both projects and both were the same, just one worked and the other not.

 >:(

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mouse pick event and render texture
« Reply #4 on: January 23, 2019, 12:39:11 AM »
Hi,

 not cool, I would recommend you get to the bottom of this, lileky your camera z order is different or slighty positionned differently compare to the object you are raycasting against. Else you may face this issue again and struggle one more time.

 Bye.

 Jean

LogLady

  • Full Member
  • ***
  • Posts: 150
Re: Mouse pick event and render texture
« Reply #5 on: January 23, 2019, 09:30:40 AM »
Yeah. I hate when this happens but I really couldn't figure the difference between one project to another. I did everything equal on both projects, even the hierarchy positions (I know it has no influence on anything...).

Thanks for the help!