-
Notifications
You must be signed in to change notification settings - Fork 19
Fixes #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #8
Conversation
…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
Okabintaro
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
| 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++; | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
| //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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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!
| icons[i].rectTransform.LookAt(Camera.current.transform.position); | ||
| backgrounds[i].rectTransform.LookAt(Camera.current.transform.position); |
There was a problem hiding this comment.
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.
Also thanks to @ihatethn931 for finding this in #8
|
I incorporated your changes to the new release, except for the rotation oft the quickwheel, which I am not sure about yet. |
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.