Home › Forums › General Questions › Ehanced camera controls how to…
- This topic has 6 replies, 3 voices, and was last updated 3 years, 7 months ago by picpic2006.
-
AuthorPosts
-
2021-03-25 at 12:28 pm #39768picpic2006Participant
Hi, i’m new in verge3d, i’m trying to understand all concepts behind, it seem to be a powerful tool. i try to replicate this kind of demo with it, but i can’t find any sources to understand how to work with the camera to control orbit like this !
2021-03-26 at 8:12 am #39784Yuri KovelenovStaff2021-03-26 at 8:20 am #39786angusCustomerHi Yuri,
This seems to be the most fundamental thing people need. On the Verge 3D puzzles section there is no class for ‘navigation’, given that everyone is asking for this could this not just be added into the Verge 3D puzzles section, so the ability to use WASD to control the camera and to fly
2021-03-26 at 11:06 am #39789Yuri KovelenovStaffVerge3D supports first-person controls out of the box. This is map navigation controls that require coding.
E.g. for Blender
https://www.soft8soft.com/docs/manual/en/blender/Camera.html#firstperson_camera_settings2021-03-26 at 1:07 pm #39792picpic2006Participantthanks for the reply, i understand that i have to do this by code, the probleme is how to import orbitcontrol.js from this exemple and use it for the camera can we do that with puzzle or should i import it in a given script and pass the camera to it ?
2021-03-30 at 6:51 am #39836picpic2006ParticipantHi
I tried several things but nothing work for me at the moment.
I read the documentation, i found that i can pass code in runcode function.https://cdn.soft8soft.com/demo/examples/index.html?q=misc#misc_controls_orbit
In this exemple all the scene is created by code that is less difficult to understand to me but my test is made with the default template so my camera is all ready done in blender. I made it with no controls but now i have to point to it and pass to orbitcontrols and do see where to do that. I try to my project.html, but didn’t work to.
Can you give me a way to go for the moment i’m in a dark room2021-04-02 at 3:36 pm #39888picpic2006Participanthi, i finally manage to import and use orbitcontrol
First i added in my .html
type module to import in ncsExplorer the script<script type=”module” src=”NCSExplorer.js”></script>
then in my javascript
import { OrbitControls } from ‘./OrbitControls.js’;
and finally
function runCode(app) {
var cam = app.scene.getObjectByName(‘MaCameraFixe’);
var controls = new OrbitControls(cam,app.renderer.domElement);
controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled
controls.dampingFactor = 0.05;
controls.screenSpacePanning = false;
controls.minDistance = 100;
controls.maxDistance = 3000;
controls.maxPolarAngle = Math.PI / 2.5;}
Do you think this is the way ?
For me it work locally but i can’t upload to the serveur i couldn’t load my resource !
-
AuthorPosts
- You must be logged in to reply to this topic.