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

Prevent raycaster detecting buttonpress while orbiting #557

Open
nigec opened this issue May 20, 2023 · 2 comments
Open

Prevent raycaster detecting buttonpress while orbiting #557

nigec opened this issue May 20, 2023 · 2 comments
Labels
Question Questions platform functionality, help with platform projects.

Comments

@nigec
Copy link

nigec commented May 20, 2023

Prevent raycaster detecting buttonpress while orbiting

Description

-How would I prevent raycasting while orbiting,
I'm using orbiting to replicate a panoramic scene, my problem is while the mouse button is down to orbit, the raycaster detects the objects and fires the action

image_2023-05-20_125833442

As the scene panes with the mouse button down if I pass over the doors and buttons on the keypad, they will trigger, I want the orbit to work with left click n hold

@nigec
Copy link
Author

nigec commented May 20, 2023

scifi3.zip
here is the file

@nigec
Copy link
Author

nigec commented May 21, 2023

orbit.zip
maybe like this? works if the object is in a group, it's not detected as the camera orbits:

`
var orbit = program.getObjectByName("orbit");
var box = program.getObjectByName("box");
let curCamX;
let preCamX;
var turning;
function initialize() {
}

function update() {
curCamX = orbit.position.x;
if(preCamX == curCamX ){
turning = true
} else{
turning = false
}
preCamX = curCamX;
var intersects = scene.raycaster.intersectObjects(scene.children,turning);
for(var i = 0; i < intersects.length; i++)
{
if(Mouse.buttonPressed(Mouse.LEFT) && intersects[i].object.name =="box")
{
console.log("hit");
}
return scene;
}
}
`

@tentone tentone added the Question Questions platform functionality, help with platform projects. label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Questions platform functionality, help with platform projects.
Projects
None yet
Development

No branches or pull requests

2 participants