Hi,
I add collisions to an ArcRotateCamera
in my project. No problem on this side.
I would like to disable the “sliding” effect (If there is a collision, no movement) in some cases.
So, I looked at the Collider
class and especially this function :
_getResponse = (pos: Vector3, vel: Vector3)
, but I can’t get the desired result.
I tried this, but it does not work properly :
public _getResponse(pos: Vector3, vel: Vector3): void {
pos.addToRef(vel, this._destinationPoint);
vel.scaleInPlace(this._nearestDistance / vel.length());
this._basePoint.addToRef(vel, pos);
pos.subtractToRef(this.intersectionPoint, this._slidePlaneNormal);
this._slidePlaneNormal.normalize();
this._slidePlaneNormal.scaleToRef(this._epsilon, this._displacementVector);
pos.addInPlace(this._displacementVector);
if (!this.shouldSlide()) return; // ADDED
this.intersectionPoint.addInPlace(this._displacementVector);
this._slidePlaneNormal.scaleInPlace(Plane.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint));
this._destinationPoint.subtractInPlace(this._slidePlaneNormal);
this._destinationPoint.subtractToRef(this.intersectionPoint, vel);
}
Can anyone tell me how I could disable this effect?