Jedarch

AutoRotationBehaviors and idleRotationSpeed

Recommended Posts

I am unable to modify (increase) the idleRotationSpeed of my ArcRotateCamera.  I tried adjusting the values of speed.idleRotationSpeed but to no avail; the arc rotation camera always circles the object at the same rate.  Here is a code snippet:

var camera = new BABYLON.ArcRotateCamera("arcCam",
10,1,30,
BABYLON.Vector3.Zero(),scene);
camera.attachControl(canvas,true);
camera.upperBetaLimit = Math.PI / 2;
camera.lowerRadiusLimit = 4;
var speed = new BABYLON.AutoRotationBehavior("camera",scene);
speed.idleRotationSpeed = 0.01;
speed.parent = camera;
camera.useAutoRotationBehavior = true;

Share this post


Link to post
Share on other sites

Hi Jedarch, welcome to the forum.

https://www.babylonjs-playground.com/#6FBD14#38

I did a little "hacking" on the BABYLON.AutoRotationBehavior class/object... which I "borrowed" from the framework source, and inserted into a BJS playground demo.

Open JS console, as wanted... see some logging I do.

Line 225 sets the idleRotationSpeed.  It is broken, as Jedarch claims.  Thx for the bug-find, J!

Lines 123-141 is where I am testing things.  Line 133 is NOT changing values... when I change values in line 225 .idleRotationSpeed.

I think it should.  :) 

Ok, that's all I have, so far.  Still testing.  Something is goofy in this area of the code.  I need fresh coffee, first.  heh.

Share this post


Link to post
Share on other sites

Hi Wingnut,  Thank you for the welcome to the forum and for looking into this topic.  I'll try and follow the code you identified above although I'm not an expert on it myself.  Glad I found the bug inadvertently so it can be fixed.   Glad there are experts within this community who know how to do so.  I discovered Babylon.js just recently.  Fascinating software and great accomplishment to its creators.  Looking forward to seeing the software and community grow in years ahead.  Have a great day!

Share this post


Link to post
Share on other sites

Thank you for your answer as well Sebavan.  As it turns out, my syntax was wrong when stating the behavior (Should be "camera.autoRotationBehavior.idleRotationSpeed", NOT "camera.AutoRotationBehavior.idleRotationSpeed").  Wingnut, I don't know if you noticed something different with respect to your insight on my inquiry, but Sebavan's example which led me to the code below solves the problem:  Here is my code adopting Sebavan's syntax on "autoRotationBehavior"  Thank you both again with your help for my question...Problem is solved:

var camera = new BABYLON.ArcRotateCamera("arcCam",
10,1,30,
BABYLON.Vector3.Zero(),scene);
camera.attachControl(canvas,true);
camera.upperBetaLimit = Math.PI / 2;
camera.lowerRadiusLimit = 4;
camera.useAutoRotationBehavior = true;
camera.autoRotationBehavior.idleRotationSpeed = 0.25;
camera.autoRotationBehavior.idleRotationWaitTime = 1000;
camera.autoRotationBehavior.idleRotationSpinupTime = 500;

Share this post


Link to post
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.

Guest
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.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.