Skip to content

Conversation

@ihatetn931
Copy link
Collaborator

Quickslots now face the camera instead of being straight up and down.
Change all "parent = transform" to "transform.SetParent(transform)" to get rid of log spam
Fixed all the errors in the log (added some null checks and if steamvr is initialized checks).
Hand Icon is now placed where the pointerdot is.

…nged all the "parent = parent" to "SetParent(parent)" to get rid of log spam, the hand icon is now located right at the pointerdot, got rid of all the error in the log
Copy link
Owner

@Okabintaro Okabintaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fixes for the logspam, I noticed them but haven't gotten around to it.
I think some things can be solved better though, see the comments.

Also please don't commit project files from visual studio. We should add those to the .gitignore probably.

base.Init(newTarget);
ArangeIconsInCircle(wheelRadius);
OnSelect(this.target.GetActiveSlotID());
if (newTarget != null)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I think I would prefer

if (newTarget == null)
  return;

in the beginning though. Looks a bit cleaner and avoids too many indentations.

Comment on lines +110 to +141
if (this.target != null)
{
//this.HandleInput();
int i = 0;
int num = this.icons.Length;
while (i < num)
{
uGUI_ItemIcon uGUI_ItemIcon = this.icons[i];
icons[i].rectTransform.LookAt(Camera.current.transform.position);
backgrounds[i].rectTransform.LookAt(Camera.current.transform.position);
if (!(uGUI_ItemIcon == null))
{
float slotProgress = this.target.GetSlotProgress(i);
float slotCharge = this.target.GetSlotCharge(i);
InventoryItem slotItem = this.target.GetSlotItem(i);
uGUI_ItemIcon.SetBarValue(TooltipFactory.GetBarValue(slotItem));
if (slotProgress < 1f)
{
uGUI_ItemIcon.SetProgress(slotProgress, FillMethod.Radial);
}
else if (slotCharge > 0f)
{
uGUI_ItemIcon.SetProgress(slotCharge, FillMethod.Vertical);
}
else
{
uGUI_ItemIcon.SetProgress(1f, FillMethod.None);
}
}
i++;
}
}
Copy link
Owner

@Okabintaro Okabintaro Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you copied parts of the decompiled code from uGUI_QuickSlots.Update().
Do you think this could be solved by just calling base.Update() here? That would be perfect.

I prefer to find ways to mod without copying too much code from the original game to avoid copyright issues.
Also the decompiled code looks bad. This should be a for loop and this is weird: if (!(uGUI_ItemIcon == null)).

But if we can't call base.Update() here I think it should be fine to keep it here after cleaning it up and changing it a bit. Or actually just move it to Activate() We don't need to update the progress each frame in Update() since the quickslots are only visible for a short time.

Comment on lines +61 to +68
//TODO: set it so the hand icon does not rotate with controller
//var handReticle = HandReticle.main.gameObject.WithParent(rightControllerUI.transform);
var handReticle = HandReticle.main.gameObject.WithParent(VRCameraRig.instance.laserPointerUI.pointerDot.transform);
handReticle.GetOrAddComponent<Canvas>().worldCamera = uiCamera;
handReticle.transform.localEulerAngles = new Vector3(90, 0, 0);
handReticle.transform.localPosition = new Vector3(0, 0, 0.05f);
handReticle.transform.localScale = new Vector3(0.001f, 0.001f, 0.001f);
handReticle.transform.LookAt(Camera.current.transform.position);
handReticle.transform.localRotation = Quaternion.Euler(40, 0, 0);
handReticle.transform.localPosition = new Vector3(0, -5, VRCameraRig.instance.laserPointerUI.pointerDot.transform.localPosition.z);//new Vector3(0, 0, 0.05f);
handReticle.transform.localScale = VRCameraRig.instance.laserPointerUI.pointerDot.transform.localScale * 2;//new Vector3(0.001f, 0.001f, 0.001f);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try this change out when I got the time!
Would prefer having a switch/toggle though in the settings since I quite like where the reticle is right now.

{
canvas.enabled = true;
transform.position = controllerTarget.transform.position;
FPSInputModule.current.lockRotation = true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh so you lock the rotation when toggling the quick wheel. That's a good idea!

Comment on lines +92 to +93
icons[i].rectTransform.LookAt(Camera.current.transform.position);
backgrounds[i].rectTransform.LookAt(Camera.current.transform.position);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was actually intentional that the quick wheel is flat up/down since I found it more natural to use.

Another way to do it would change or enable this right: https://github.com/Okabintaro/SubmersedVR/blob/master/SubmersedVR/VR/VRQuickSlots.cs#L174-L176
Thats how its done for vehicle but I found it much better being constrained and only rotate in the yaw when diving or on foot. Will have to test a bit more though.

Okabintaro added a commit that referenced this pull request Feb 2, 2023
Also thanks to @ihatethn931 for finding this in #8
@Okabintaro
Copy link
Owner

I incorporated your changes to the new release, except for the rotation oft the quickwheel, which I am not sure about yet.
Indeed just calling base.Update() was fixing the battery values not updating.
Thanks a lot!

@Okabintaro Okabintaro closed this Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants