Hi… for quite a while I’ve been successfully using a brilliant Orbit Controls script that was kindly shared on this forum by @ROBYER1 (I’ve attached it here for ref).
The script has been working fine with a scene I’ve recently been building which was running on Needle 2.67.11-pre. However, earlier today I updated to Needle 3.2.0-exp and the orbit script suddenly stopped functioning. I further updated to Needle 3.2.1-exp this afternoon but it hasn’t altered the fact that the orbit script still isn’t functioning. Nothing else in the project has changed other the Needle updates… and if I open a backup/archive copy of the project that’s still on 2.67.11-pre then the orbit script runs as expected.
ADDITIONAL INFO
I’m on Mac OS Ventura 13.3.1
If anyone has any thoughts on what might have happened and what the solution might be, I’d be very grateful Thanks in advance!
import { Behaviour, GameObject } from "@needle-tools/engine";
import { Camera } from "@needle-tools/engine";
import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls";
import { LookAtConstraint } from "@needle-tools/engine";
import * as THREE from "three";
import { getWorldPosition } from "@needle-tools/engine/src/engine/engine_three_utils";
import { Physics, RaycastOptions } from "@needle-tools/engine";
import { serializeable } from "@needle-tools/engine";
Nope… it really doesn’t like that, at all. The preview now runs but the scene content jumps around wildly and in a frenzied manner in the browser window
I’m sorry but I have to dash off just for now. I’ll be able to have another look at it all in the morning
Yesterday, having rebuilt the project as-new from scratch (twice) and having tried a number of other things without any success, I came at the problem again this morning with a fairly heavy heart.
However! I’ve just this minute opened the project up and before doing anything to the scripting I updated from Needle 3.2.1-exp to 3.2.2-exp and the whole thing worked straight away. i.e. @ROBYER1’s original script (unedited and as attached in the OP) works absolutely perfectly once again.
So, while I would unquestionably love to know (and understand!) more about what just happened, and why it’s all okay again, I’m happy to instead just take the win where I find it
and there should not be a reason (at least right now) for a component to import the physics class and create a new instance of it (cant imagine a reason for OrbitControls to do that)
I want to try tree shaking physics (or make them lazily load) at some point too to reduce the overall engine size (1mb in the bundle is the rapier engine)