0
Answered

Custom Action for Oculus Quest working but Conditions not working.

eagleeyez 6 months ago in Game Creator updated 6 months ago 6

Custom Action for Oculus Quest working but Conditions not working.

I made this custom action for oculus quest get thumb sticks and it works, I see the vector getting updated in the Inspector and I see also the local variables also getting updated.


I then create in GC a new trigger onStart, condition == if variable number from my local variable x is greater than 0.1

Then action display message or change color or something else.


But this condition does not work. And btw your condition Vector3 has no compare functionality like numbers do


What am I doing wrong please?


I have also made a custom igniter script for all the triggers for the oculus quest buttons and that all works. And condition work with triggers but not from my action thumb stick or velocity


I am relatively new to programming but I am coming along nicely as in the future I would like to be able to make custom actions for me and the community. I am sticking with GC but learning programming at the same time.

namespace GameCreator.Core
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using GameCreator.Variables;

[AddComponentMenu("")]
public class ActionOculusThumbStick : IAction
{

#if UNITY_EDITOR
public static new string NAME = "OculusQuest/ActionOculusThumbStick";
#endif
[VariableFilter(Variable.DataType.Number)]
public VariableProperty setX;
[VariableFilter(Variable.DataType.Number)]
public VariableProperty setY;

public bool debugLog;
public float multiplier =1;
public Vector2 axisValue;
private OVRInput.Controller controllerInput;

public enum controllerEnum
{
LeftController,
RightController,
}
public controllerEnum touchController;

public void Start()
{
switch (touchController)
{
case controllerEnum.LeftController:
controllerInput = OVRInput.Controller.LTouch;
break;
case controllerEnum.RightController:
controllerInput = OVRInput.Controller.RTouch;
break;
}
}
public void Update()
{
axisValue = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, controllerInput);
setX.Set(axisValue.x * multiplier);
setY.Set(axisValue.y * multiplier);

if (debugLog == true)
{
Debug.Log("X_Axis = " + axisValue.x + " Y_Axis = " + axisValue.y);
}
}
}
}

Unity version:
2019.5.15f1
Game Creator version:
1.1.5

Ok, I worked it out. I need to use the Trigger on variable schanged.

Now it is working right.

But still is the code above ok, what do you think? or should I do something differently?

Then now I will finish up my actions for quest.

Answered

Hey EagleEyez, this looks really good! Feel free to post this Action in the Game Creator Hub: https://hub.gamecreator.io. If you have a Twitter account, we'll gladly post it there crediting you.

Cheers!

Ok, how do I post to the HUb? and what catagory as I have included triggers and actions for the quest as a small package with a demo scene. Oculus intergration and game creator will have to be first installed before this package will work.

Hi Marti, I really cannot find anything on how to upload to the hub. Nothing, no info on the Hub page.

+1

You need to change your Role to Publisher. Click on Settings in the top Right.

+1

Thanks,done it. That was making me crazy