Jump to content

Problems with a camera and models


Recommended Posts

Greetings! I had an idea for the organization to move the camera when the cursor to a specific side of the screen, for example - have brought the cursor to the top of the screen, the camera moves up. Brought down - the camera moves down. But I do not know how to organize it.


There is another problem with importing models from 3ds Max 2015 models do not rotate absolutely nothing, no one axis. Tried already and simple rotation, and rotation directly in 3ds Max. Even tried to change the angle of the file .babylon. Nothing changes. Blender model of spin, but their appearance does not suit me, the model curve.


Also wanted to ask. Is it possible for someone to ask for help (direct support), can somebody help me a little bit in the course of writing my project?

Link to comment
Share on other sites

Good afternoon DigitalHilson,


I'm not really sure what the problem is, can you plz create on example in the playground? Or post some code ?


About helping you to write your project... I think that if you post the doubts and problems that you find, everyone will try to help you out, no problem on that.



Link to comment
Share on other sites

Hey DH, have you read THIS thread...


There is various talk about rotation being vector3 or quaternion.  Is there an option in the 3dsMax exporter... regarding quaternions?  Maybe you can change that setting and try again.

SOMEWHERE, I thought I saw deltakosh mention quaternions for 3DS Max. If there is a setting for quaternions, try playing with that... see if your rotations start "holding".

On the subject of camera aiming to screen quadrants... when mouse is over that quadrant... can do.

Take a look at http://playground.babylonjs.com/?17  That is the BabylonJS "ActonManager" doing those mouse-over actions.  Now imagine you have 4 invisible planes parented to your camera, and glued to the camera lens.  One is glued to the upper half of the view, another glued to the lower half of the view, and one for left side, and one for right side.

IF you had an actionManager on each plane, watching for mouseover triggers, then you could perform actions such as function calls.  Triggers and Actions.  If the mouse is over the left plane, call a function to aim the camera left.  If the camera is over the upper plane, call a function to aim the camera up, etc.  There are other ways, too. 

To summarize, your idea could be done with BabylonJS.  You could even do the corners of the screen. 

That's what I would do.  9 invisible planes, glued to the lens of the camera.  3 by 3 grid, covering the screen.  Mouse-over the upper left plane, and the camera aims upper left.  Or upper-center.  Or upper-right.  Fun experiment.  Maybe someone can try it in a playground, for fun.  :)

Unfortunately, we can't test .babylon files in the playground... without first getting them into playground scope.  A free github account is a nice way.

Link to comment
Share on other sites

Hi again!  :)


Click the "hide editor" button for best results.

This version of mouseover camera targeting... uses only 4 planes.... with a neutral area in the middle.  Mouse-over to the borders of the screen, and camera targeting should change. 

This will get you started, as needed, DH.  It's all done with our fabulous actionManagers.  Each plane has an actionManager attached.  Each plane two triggers registered... one for mouseOVER and one for mouseOUT.  Each trigger uses an executeCode action.

I added a property to the camera, called .delta.  It is a vector3 that gets added-to the camera.target continuously (in the animation loop).  I think I need an .addToRef down there... instead of an .add.  :)

So, the x, y, and z values that are seen in camera.delta... are the "movement orders".  Anytime a plane is moused-OUT... a function called cleardelta is called... and it zeros-out the camera.delta... causing no movement of the camera anymore.

Fun!  The 9-plane idea didn't work, because after the camera movement was made, the mouse pointer was in a different plane than it was before the move started.  Thus, un-wanted intersecting happened after each move.

This "push on the border" method of camera aiming... works a bit better.  Sort of.  :)

Set ALL .showBoundingBox = false;   ...to make plane borders disappear.

Spin the arcRotate cam around the scene a few times (by dragging in the center area) and watch what happens.  If feels like the camera is drunk.  :D  Odd.  Don't fall.

Keep in mind that I am MOVING the position of the arcCamera TARGET.  But, the mouseover borders could be used for anything, including swinging-around the arcCamera .alpha and .beta values (but leaving its .target set to the center of the scene). 

A free camera would work fine, too, and it could be automatically turned/aimed with these mouseover borders as well.

An interesting situation MIGHT arise when trying to mouseover OTHER scene objects... WHILE a border mouseover is already happening.  Chances are, box/sphere mouseovers won't work... when they happen in the border plane areas.  One might want to make the border planes very THIN... to minimize this problem.  You can test it in this demo.

Grab a zip, take it home, or modify my demo, hit RUN lots of times, do a SAVE sometimes, and send us the playground urls of your discoveries and inventions (if you like).  Be well, guys.

Link to comment
Share on other sites

  • 2 weeks later...


Thank you Wingnut!
Here there is still probema while driving the cursor out of the browser, such as tabs or taskbar Microsoft Windows, the movement still sign up and the camera will still move, even if the window is inactive. Is it possible to add borders to the movement of these zones? I tried to turn out like this - to create an inactive layer is closer to the edge of the screen directly onto a moving layer - up - is not working. Do you have any suggestions?
Link to comment
Share on other sites

Still thinking.  :)  Right now, I'm thinking about adding an actionManager to Layer.  Its a bit ridiculous, but, BJS Layers is one way to replace the background of the canvas... http://playground.babylonjs.com/#1XQKP1#4

So... hmm.  Maybe Deltakosh will think about adding a method to it... that reports click locations.

There's other ways.... still thinking.  :)

I also understand what you are saying about arrow beyond scene borders.  You want to keep the arrow on the canvas.  But, this MIGHT be illegal because you are limiting the user's operating system.  What might be fun... is when your OS arrow is over a canvas, it becomes a different arrow shape... maybe 2D, maybe a real BJS mesh arrow.  When user goes outside of canvas border, it becomes a OS arrow again... and the canvas arrow disappears.  hmmm.

On a related issue, if you detach and then re-attach the camera when the arrow has gone too far... it SHOULD stop the BJS camera from moving.  You can experiment with that. 

I'm still working on a really nice easy way to get click coordinates using the canvas background only.  hmmm.  :)

Link to comment
Share on other sites



You do not quite understand. I do not want to limit the use of banned users OS. I want to make the outside scene, the camera does not move, that is, it stops moving. And if we now bring the cursor to the limits of the operating system, the camera continues to move. Here's what I have to decide.

Link to comment
Share on other sites

  • 2 years later...

Hi DH... sorry I left you hanging... here... over 2 yrs ago.  I hope you have found a solution.  :o

(I hope the poor guy didn't hang himself due to lack of assistance)  :/

Pathetic forum-helper performance by Mr. Wingnut, for sure.

How about a nice, recently-repaired playground?  http://playground.babylonjs.com/#LNEX4#1

With Love,
Threadkiller Wingy  :)


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