-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve Street controls 1 #1017
Conversation
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 improvement
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.
Could you add an explanation in the message of your fix
commit ?
Anyway, very happy to see something like this, though it needs a bit more work. Thanks a lot !
// Raycaster used to pick objects | ||
this.raycaster = new THREE.Raycaster(); | ||
// Tween is used to make smooth animations | ||
this.tweenGroup = new TWEEN.Group(); |
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.
Declare this.tweens
(which should be this.tween
) here. Side note: why do you need a group and a tween ? (I know nothing about this library)
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.
ok. side answer: First I try without a Group but I didn't manage to make it work.
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.
Ok, I'll also take a look at it to see if we can make it work
src/Controls/StreetControls.js
Outdated
// basic threeJs pick with raycaster | ||
const normalized = this.view.viewToNormalizedCoords(event); | ||
this.raycaster.setFromCamera(normalized.clone(), this.camera); | ||
const intersects = this.raycaster.intersectObjects(this.view.scene.children, 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.
This will be very very heavy if you are inside a building with a complex mesh: we need a better solution. Now, I'm not going to block this PR for this, but I would appreciate if you already have some insights on how to fix this.
Anyway, please add a warning concerning this problem for now.
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.
Finally, I use existing picking method, and pick on specific layers !!
29073df
to
d905c71
Compare
src/Controls/StreetControls.js
Outdated
this.start = this.camera.clone(); | ||
this.end = this.camera.clone(); | ||
this.end.lookAt(position); | ||
const factor = { t: 0 }; |
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.
Sorry, I meant that you could directly write new TWEEN.Tween({ t: 0 }, this.tweenGroup)
below.
// Raycaster used to pick objects | ||
this.raycaster = new THREE.Raycaster(); | ||
// Tween is used to make smooth animations | ||
this.tweenGroup = new TWEEN.Group(); |
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.
Ok, I'll also take a look at it to see if we can make it work
422fded
to
3e37235
Compare
1767609
to
3845dab
Compare
src/Controls/StreetControls.js
Outdated
this.view.removeFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.animationFrameRequester); | ||
} | ||
|
||
stopTweensAnimations() { |
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.
could you rename in stopAnimation
? the user doesn't know it's tween
.
could add this.view.removeFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.animationFrameRequester);
in stopTweensAnimations
?
or merge onComplete
and stopTweensAnimations
...
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.
yes, I've renamed to stopAnimation. And I 've remove onComplete because it's not need to be exposed.
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.
this.view.removeFrameRequester
isn't removed in all cases
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.
yes, thanks, updated
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.
Overall it seems the quality downgraded. When i click on the street to move, it takes one second to start, and then it is not smooth at all.
} | ||
} | ||
|
||
onMouseMove(event) { |
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 have an error when moving the mouse before the layer is ready. Could you add a condition like if (!layer.ready)
? Or something that fixes the error.
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.
Yes, thanks, I 've added a bugfix in View
277f54d
to
c51b59e
Compare
…ok at, tweens animations : - Mouse click on ground detection, and associated callback, that go to the clicked position - Mouse click on other object (not ground), and associated callback, that makes camera look at the position - Surfaces as helpers for the end user : - Circle displayed when user moves the mouse on the ground - Rectangle displayed when user moves the mouse on other objects (like walls of a building) - Tweens animations : - camera can move to another position smoothly - camera can look at a position smoothly in an animation
…r not ready. Before this commit, picking on a layer, that was not yet ready, thrown an exception.
To see an example, look at immersive_paris.html example, you can change building layer transparency in the debug UI.
…out doing an instanceof
Before this commit, orientedImageCamera, has a default far set to 1000, A side effect is that OrientedImageMaterial was only able to project texture to a distance of 1000, because OrientedImageMaterial uses OrientedImageCamera to project textures. Now, OrientedImageCamera default far set to 10 000, so OrientedImageMaterial projects texture to 10 km distance.
…gs' layer to 'Buildings', and increase background radius from 80 to 1 200
4f46db4
to
513ad4a
Compare
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.
thanks
Description
improve StreetControls : add click and go, surface helpers, click and look at, tweens animations :
Motivation and Context
User should have a good experience using immersive example
Screenshots (if appropriate)