Hi I’m using the orbit-camera script but i want to offset is in the x slightly. I’ve tried to modify a few things but cant get anything to work. To show you what I am trying to do, here is an image of the app with the UI. As you can see, the camera and focus point need to be offset to the left because the UI covers the left third of the screen. With the default script the focus point at the start is always dead center of the screen which is incorrect for this purpose…
I tried to modify the line as follows but didn’t seem to do anything at all: this.resetAndLookAtPoint(resetPoint, new pc.vec(this._modelsAabb.x+10,this._modelsAabb.center.y,this._modelsAabb.center.z));
Mmm, the camera will orbit its pivot point, that would be the position of the target entity.
I am not sure with your initial thought, adding a x offset to that pivot point how you would keep the camera orbit around the model center. It will orbit around the new offset position.
Maybe I could have two cameras at the same position/transform always. One for the UI (UI Layer only) which renders fullscreen as normal and one for the 3D with which I just offset its viewport X. Would that work? Any disadvantages to that?
screenPosition doesnt take into account any of the viewport offset so none of the interactions trigger correctly with a raycast. ANyone know how to get around this? Some way of getting the ray to know about the viewport offset?
Hi, I tried this and it all works great on PC with a mouse but the same build on a touchscreen device (phone) the hotspot touches seem to be offset still.
I cant see why it should be different but it seems to be…(?)
I have a build at https://playcanv.as/p/Dy6CMao6/ that demonstrates this. (Go to Purple 4> then choose cutaway then try to click hotspots…)
It’s probably related to pixel device ratio if the issue is on mobile only. Debug with the touch screen coordinates and see if they are larger/smaller than what you would expect for the screen resolution on the mobile device
I have Device Pixel Ratio enabled but if I turn this off IT WORKS, but sprites look rubbish I cant live with that. I guess I need an additional offset for mobile to based on the Device Pixel Ratio. ANy ideas how I would do that?!?
The screen coordinates differ whether you have pixel device ratio enabled or not. So you will need to convert the offset for the view port based on whether it has been enabled or not