Playmaker Forum

PlayMaker Help & Tips => VR Help => Topic started by: Destek99 on August 19, 2019, 06:00:21 AM

Title: Continually update raycast location?
Post by: Destek99 on August 19, 2019, 06:00:21 AM
Hi, I am working with the Oculus Go and I am a bit stuck on raycasting.
I am using the Oculus Go custom actions by @HendrikB as well as the "draw line" action from the ecosystem.

My current FSM looks like this
(https://i.imgur.com/ueyW7ja.png)
(https://i.imgur.com/Wfz6FFI.png)

The draw line lives in the "Raycast" state, so I guess there needs to be a loop in there somehow so as long as the "Oculus Go Dpay Button" is down then its continually updating the location of the "End OFfset" of the draw line action

But I am stuck as to how to do this
Title: Re: Continually update raycast location?
Post by: daniellogin on August 19, 2019, 06:52:49 AM
First thoughts are splitting it up.

For example I've made automatic (hold the trigger) weapons in the past where the trigger itself is it's own FSM which simply updates a bool. So you press, goes to next state which is bool on, when you stop presssing, goes back to first state and bool is flipped back to off. That's it. Then another FSM sits in a state where it gets the bool (from the first fsm) every frame, and then moves to the next state when the bool is true. This next state can do an everyframe or a loop because it also watches for the trigger bool to be false, at which points it exits back to the idle state, etc.

That action doesn't have an 'every frame' option though. I don't know how it works. Thing is about making it a loop, there is a limit of how many time it can repeat through the same state before it halts as an endless loop error. A way around this is to use a Wait time between cycles or Next Frame Event.
Title: Re: Continually update raycast location?
Post by: Destek99 on August 21, 2019, 09:34:37 AM
Thanks for the advice, I have split everything up as well as I can
I now have the following

My setup is as follows,
A raycast in its own FSM
(https://i.imgur.com/IqjNmJV.png)

A bool loop as per your recommendation
(https://i.imgur.com/rJv7RjF.png)

And a drawline fsm on trigger press
(https://i.imgur.com/WYy5WdH.png)
(https://i.imgur.com/W4jesix.png)
The final FSM does work as its correctly drawing a line to the object location that has been hit by the constantly firing raycast FMS, and also destroys the line as part of the 3rd state. However when I try to send an event as part of this it never reaches the intended object
(https://i.imgur.com/f6uecYV.png)
, it seems that "RaycastHitObject" never populates which I have confirmed from the globals window
(https://i.imgur.com/GlSNAyi.png)

Any ideas why this might be? Thanks.