Hello!
I would like to create a camera movement controller similar to your orbit camera example. But in my case I want the camera to move only on the X and Z-axis independently from the camera entity forward vector.
I try to modify this part to convert the Y-axis value to Z but it’s going in the wrong direction based on camera pitch. What am I doing wrong? Could you please advise the right solution for this case?
MouseInput.prototype.pan = function(screenPoint) {
var fromWorldPoint = MouseInput.fromWorldPoint;
var toWorldPoint = MouseInput.toWorldPoint;
var worldDiff = MouseInput.worldDiff;
// For panning to work at any zoom level, we use screen point to world projection
// to work out how far we need to pan the pivotEntity in world space
var camera = this.entity.camera;
var distance = this.orbitCamera.distance;
camera.screenToWorld(screenPoint.x, screenPoint.y, distance, fromWorldPoint);
camera.screenToWorld(this.lastPoint.x, this.lastPoint.y, distance, toWorldPoint);
worldDiff.sub2(toWorldPoint, fromWorldPoint);
var distanceVec = new pc.Vec3(worldDiff.x, 0, worldDiff.y);
this.orbitCamera.pivotPoint.add(distanceVec);
};