~Camera: Focal Point Sphere

Hi,

How to put a SPHERE 100 units in front of free camera, to mark the focal point?

Normalize target of camera to get vector of view. Then would we add or subtract or multiply on the vector to get the position for the sphere?

: )

https://playground.babylonjs.com/#3Z5VXS

1 Like

getFrontPosition() ???

Too easy!

I’ll step into that function to see add, subtract, multiply…

drumroll… :drum:

It is subtract… then normalize vector, then scale and then add? Awesome.

        TargetCamera.prototype.getFrontPosition = function (distance) {
            var direction = this.getTarget().subtract(this.position);
            direction.normalize();
            direction.scaleInPlace(distance);
            return this.globalPosition.add(direction);
        };

I will need read up in docs and try each, to imagine how add, subtract , and scale do this.

PG is helpful. Maybe I’ll override and turn off one at a time…

Thx Pryme8!

1 Like