I’m trying to update from r102 to r103 but I am running into a problem
In r102 I get the mouse position and raycast it to find intersection points just fine, but in r103 my intersections are not accurate. It seems like something has changed between r102 and r103 related to this process, but I can’t find any documentation on exactly what changed. The migration notes don’t say anything about this. I test in r102, it works. I test in r103 the intersects are wrong.
Can anyone help me out?
I think it’s related to the CombinedCamera that I’m using. I swapped that with a normal perspective camera and it seems to work. So now I’ll look into how to update the combinedcamera… since that was removed in a previous version and I guess something hasn’t been updated in it from r102 > r103.
if you use raycaster.setFromCamera and you say the type of camera that you use was removed - then obviously it is not going to work. btw I have never even heard about CombinedCamera
no worries- I have changed my code to use a variable to switch between a perspective and orthographic cameras, and made it convert/translate their settings when switching between them. So I don’t have to use combinedcamera anymore.
It looks like CombinedCamera was removed in version 88 but it basically just let you switch between an orthographic and perspective projection with a single camera, which can be pretty convenient.
Looking at the CombinedCamera source it looks like it doesn’t add the isPerspectiveCamera
or isOrthographicCamera
field to the camera object, which raycaster uses initialize the ray. Some raycasting functionality may also depend on that field, as well, like sprites or lines for determining how they are rendering. You might be able to fix it by adding that appropriately field on the CombinedCamera object?
It already has those in the CombinedCamera source that I was using. Maybe the raycasting code doesn’t check for that anymore. Anyways- I’m trying to update to the latest version, so I’d rather just use what works. Seems to work fine now with how I have it set up.
If it’s working for you awesome!
It already has those in the CombinedCamera source that I was using.
Just to clarify unless you added those flags in yourself it doesn’t look like they ever existed on the CombinedCamera in the three.js source. The raycasting logic expects isPerspectiveCamera
or isOrthographicCamera
flags while the last CombinedCamera source uses inPerspectiveMode
and inOrthographicMode
.
Oh I see… You’re correct- sorry about that!