Skip to content
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

Better 2D cursor #75

Merged
merged 6 commits into from
Mar 28, 2018
Merged

Better 2D cursor #75

merged 6 commits into from
Mar 28, 2018

Conversation

InfiniteLee
Copy link
Contributor

@InfiniteLee InfiniteLee commented Mar 17, 2018

no more cursor lock; super-cursor follows around cursor screen position; look-controls are paused when an interactable is grabbed; colors changed; cursor no longer appears to be in "hovered" state when moused over the floor or table; system cursor is hidden.

…on; look-controls are paused when an interactable is grabbed; colors changed; cursor no longer appears to be in "hovered" state when moused over the floor or table;
# Conflicts:
#	src/room.css
#	src/room.html
}
},

_handleMouseDown: function(e) {
this.mouseDown = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This flag appears to be unused.

this.el.setAttribute("raycaster", { origin: this.origin, direction: this.direction });

let className = null;

if (!this.isGrabbing) {
const intersections = this.el.components.raycaster.intersections;
if (intersections.length > 0 && intersections[0].distance <= this.data.maxDistance) {
isIntersecting = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of storing isIntersecting, className, point and currentDistance I would probably just store the interesection itself.

@@ -62,49 +86,70 @@ AFRAME.registerComponent("super-cursor", {
}

if (this.isGrabbing || !isIntersecting) {
const head = this.el.object3D;
head.getWorldPosition(this.origin);
head.getWorldDirection(this.direction);
const distance = Math.min(
Math.max(this.data.minDistance, this.currentDistance - this.currentDistanceMod),
this.data.maxDistance
);
this.currentDistanceMod = this.currentDistance - distance;
Copy link
Contributor

Choose a reason for hiding this comment

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

bit confused what this is doing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the logic that allows you to scroll the mouse wheel to move the object closer or farther from you.

@InfiniteLee InfiniteLee merged commit 53313ec into master Mar 28, 2018
@brianpeiris brianpeiris deleted the feature/unlocked-cursor branch September 24, 2018 17:30
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.

None yet

2 participants