Jump to content

How to gracefully undo Targetcamera.lockedTarget


Recommended Posts

Was try to using locked target to keep my subject "in frame' rather than a corresponding animation to rotate camera (QI calls camera._getViewMatrix() for meshes that are locked on to cameras as they are moved).  It is much more accurate.  Problem is I want to discontinue at one point.  When I do, camera jumps back to before.  Want it to stay where I left off.  Tried this, but not what I want:

// unplug hero from sceneCamera
var tmpScale = BABYLON.Vector3.Zero();
var tmpTrans = BABYLON.Vector3.Zero();
var tmpRotQ  = new BABYLON.Quaternion();
sceneCamera._viewMatrix.decompose(tmpScale, tmpRotQ, tmpTrans);
sceneCamera.rotation = tmpRotQ.toEulerAngles();
sceneCamera.lockedTarget = null;


Link to comment
Share on other sites

@Klaas, this almost works indirectly by assigning a stand in when you no longer wish to track.  Does not give you the ability to (re-)start animating via rotation though.

I also am placing a sign then a dialog in front of the camera based on its rotation / direction  (scene).  They are now placed at the off screen place the lockedTarget was initiated.  Too bad,  locked target gives very professional results.  Even the snap to the target looks good, because the fire grand entrance makes it look like all those cut-to's of film & tv.

Link to comment
Share on other sites

hahah... what a marvelous scene, JC!  You are such a mega-talent!  It's... friggin' perfect.  Are you using the timeControl event thingy?  (I guess I could go sniff code).

(I could go for a zip-up, too, if you feel so inclined.)  That's a sweet sweet intro!  Well done.

Link to comment
Share on other sites

Yes this is the demo scene I made for QI.  Just updated it so the dialog at the end works.  Turns out only 1 camera can be a picker.  I dispose of the bottom form at end.  You could always just click on the Whoopstopia button to reload the scene.  Not as fast as restart, but no way to get around this BJS limitation.

Need to get a couple of the scenes up there, which are missing (Human Emotions & Rig Developer)

Link to comment
Share on other sites

I don't need the blender files.  I want a demo of the QI stuff... so I can stare at the code while eating xmas cookies... and see how ya did it... and steal all your code for my own "sequence" project.  Sequencing is excellent fun.  It's story telling, baby.  Of course, I could always use the "click to continue" to turn the pages of the story... but... timing is so crucial to story telling.  So is audio.  The sound effects have to be just right.  And... oh... we can do lip sync on face bones, too.  Coooool.

Ok, I got the repo... I got the goods.  A couple hundred hours... I'll make something as cool as your thing, JC.  (maybe).  For some reason, though, my mind is on cartoons of Donny Trump fornicating with farm animals.  :o  I wonder what THAT is all about.

Thanks Jeff... for the cool demo and system.  I know you say it's Blender-only, etc etc... but... nah.  I'll program that time controller from the playground... you watch.  I got a soldering iron and these here xmas cookies... I can jury-rig something together.  I don't need bones, either.  I just want to make simple robots talk and fart and kick things.  Rock'em Sock'em, BJS-style.

I need clocked (actionManager-aimed) events, with pre-fetched media files... so I can get "mbone"-grade sync.   :)

(what did he say?)

Remember MboneThat was really something, huh?  *scratch scratch*  Pretty close-to "start your own internet TV station".  Gotta put-on a good show.  BJS knows how to do that.  JC showed us how.  :)

Just for fun, I tried to match Trumpelstiltskin's hair color... to a color3 rgb value on a BJS plane.  Couldn't do it!  His hair is some color that is impossible to match with a BABYLON.Color3.  Weird.  ;)  Might need a "urine-colored radiance" post-process/shader.

Link to comment
Share on other sites

You can assign a POV processor on a mesh & after QI is initialized (no shapekeys or skeleton unless Blender)

var doorSnd = new BABYLON.Sound("tomb", "tomb.mp3", scene);

var leftDoorQueue = new QI.PovProcessor(myMesh); // or camera / Light
var moveLeft = new QI.MotionEvent(doorMillis, new BABYLON.Vector3(4.4, 0, 0), null, {sound: doorSnd}); 
leftDoorQueue.queueEventSeries(new QI.EventSeries([moveLeft]);

The Door meshes were exported as QI.Meshes, but did not have to be.  Not sure I should help you with your toon, but it did pop into my head that a Hillary face would look good on a goat or donkey.  I cannot un-see that:angry:.

When the sound is pre-defined first, like the doorSnd, all you do is set the doorMillis  for your corresponding MotionEvent to the same length.  I viewed the car crash sound with Audcity.  Saw how long the brake screech was. Set my first event to that, and it hit EXACTLY at the right time. 

Link to comment
Share on other sites

Have not pushed this code yet, but am switching to it.  It does not set rotation.z, so my sign drags a little below the ground.  I was setting the vertical position of the sign anyway, so will just change the amount.  The sign mesh origin is placed above it, and in the center in Blender for a simple rotation animation to work.

Sounds like lookAt will not work when things get vertical.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...