Jump to content

LOD and camera.parent


eboo
 Share

Recommended Posts

hi,

i use a camera with parent :P

parent is the caracter.

i'd like to use LOD instead of a self drawn mesh unloader and reunloader.

i'd like to use LOD with distance to parent.camera

here is a sample: http://www.babylonjs-playground.com/#1DZUBR#18

i'd like to set "test" distance from parent (firebox here).

 

Question 1: is it possible?

Question 2: my script (more complexe) look like it's taking LOD "origine" on (0,0,0). but i don't know why :P not player, not camera. how can it be possible?

Max "shown" Value used is distance from camera to parent. (this is ok)

But boxes are "shown or hidden" with distance from (0,0,0) to the box.

 

x x x

0,0,0x x x <- shown       far away ->                       camera x  <-used distance ->   x target

x x x

sorry for my english skill :P

 

 

 

Link to comment
Share on other sites

:)

thanks, it's working as expected :)

 

but :P

is it possible to use/modify/hack LOD system?

actual system use distance between camera and knot00

my target is to use this with a "distance" similar to:

var distance = (fountain.position.subtract(knot00.position)).length();

 

in my exemple, result would be boxes around the firebox and no element on corner.

No matter how far is the camera

 

 

 

 

 

Link to comment
Share on other sites

Hacking is FUN!  That's where the mad scientists hang-out.  :)

(heretofore... firebox == spacecraft)  ;)

Eboo needs LOD... with distance... based-upon a user-settable (and possibly constantly-repositioning) origin.  Cooooooool.  We need this... for from-within-spacecraft views.  LOD would then be based-upon distance of LOD mesh... from/to spacecraft mesh.  And then we completely ignore issues with the followCam.  Wow. 

So, eboo... (love the animated forum pic, btw)... needs to cross-offset the distance of followCam-to-spacecraft... and use THAT result ... in the computing of the LOD.  err... something like that.

hmm.  This is a fun thing.  This might lead to some framework feature-adding... yum!

Link to comment
Share on other sites

that's it

            var distanceToCamera = (boundingSphere ? boundingSphere : this.getBoundingInfo().boundingSphere).centerWorld.subtract(camera.globalPosition).length();

in my case should be something like

 

if(!!camera.parent)

           var distanceToCamera = (boundingSphere ? boundingSphere : this.getBoundingInfo().boundingSphere).centerWorld.subtract(camera.parent.globalPosition).length();

else

            var distanceToCamera = (boundingSphere ? boundingSphere : this.getBoundingInfo().boundingSphere).centerWorld.subtract(camera.globalPosition).length();

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.

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

  • Recently Browsing   0 members

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