How to calculate translation with respect to rotation

Hi gang.

I made another one. :slight_smile:

https://www.babylonjs-playground.com/indexStable.html#UTINNB#6

Many/most BJS cameras have a property called .lockedTarget. It can be a mesh or a vec3.

It sort-of “freezes” the camera->target relationship/orientation, so when you move the .lockedTarget, the camera rides-along, automatically.

Lines 3-11… is an overload of camera… adding .aniLockedTarget() func. Most people say that overloading is unhealthy, but I don’t know any better. :slight_smile:

Doing this… makes things easy down at line 136 of the pick handler. No camera-pointing animation needed, in most cases. And we sneak-in a little nice easing, too.

Interesting/fancy code, ilia!

My code is not that pretty/structured, sorry. I code like I eat - a messy pig with no closures, and lots of grunting noises. :smiley:

2 Likes