playMaker

Author Topic: I want to store the object that sent the raycast... this should be easy...  (Read 103 times)

jemron

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Maybe I don't understand how raycasting works. I am developing for the Vive, so sometimes the ray originates from the left controller, and sometimes it originates from the right controller. I want to detect which controller sent the raycast (if that's a thing) so that I can activate a playmaker action based on which controller is currently being used.

Thank you!

jemron

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: I want to store the object that sent the raycast... this should be easy...
« Reply #1 on: November 06, 2018, 02:59:17 PM »
Anybody?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3602
    • View Profile
    • jinxtergames
Re: I want to store the object that sent the raycast... this should be easy...
« Reply #2 on: November 06, 2018, 03:11:59 PM »
Hi.
Do you already have a working setup?

When the left controller triggers, have a bool set to true and when the triggers controller triggers set the bool to false.
Then do the raycast.

After the raycast you can use a bool test to check which controller did the raycast.

jemron

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: I want to store the object that sent the raycast... this should be easy...
« Reply #3 on: November 06, 2018, 04:59:44 PM »
I need the raycast to happen first. It is basically a laser pointer that points at, and selects a button. Then, when I pull the trigger, that's when I need to know which controller is currently pointing at the button so that I can make that controller vibrate and not the wrong controller.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3602
    • View Profile
    • jinxtergames
Re: I want to store the object that sent the raycast... this should be easy...
« Reply #4 on: November 06, 2018, 11:43:22 PM »
Hi.
so the 'pointer' is moved by the controller right, not by 'looking'?

Then maybe its best to use 2 raycast, one for each controller.
and have a fsm for each one.

if you don't know how to use a raycast yet maybe this video can help a bit :


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13512
  • Official Playmaker Support
    • View Profile
Re: I want to store the object that sent the raycast... this should be easy...
« Reply #5 on: November 07, 2018, 10:44:39 PM »
Hi,

 yeah, you need one raycast per controller, this way both will act as a "Mouse over" on interactive elements in your world. and it solves the problem of knowing which controller is pointing over when there is a controller action.

on the ecosystem there is two samples that you should check out:

GetNextRaycastAllHit and RaycastHitNormal they will show you a lot of what you need to do for your case. Extrapolate that the turret in these two samples are one controller.


Bye,

 Jean