Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: jemron on November 06, 2018, 09:31:46 AM

Title: I want to store the object that sent the raycast... this should be easy...
Post by: jemron on November 06, 2018, 09:31:46 AM
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!
Title: Re: I want to store the object that sent the raycast... this should be easy...
Post by: jemron on November 06, 2018, 02:59:17 PM
Anybody?
Title: Re: I want to store the object that sent the raycast... this should be easy...
Post by: djaydino 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.
Title: Re: I want to store the object that sent the raycast... this should be easy...
Post by: jemron 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.
Title: Re: I want to store the object that sent the raycast... this should be easy...
Post by: djaydino 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 :

Title: Re: I want to store the object that sent the raycast... this should be easy...
Post by: jeanfabre 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