wasabia / three_dart

three.js rewrite by Dart, Dart 3D library. an easy to use, lightweight, cross-platform, general purpose 3D library.
MIT License
444 stars 77 forks source link

How can I use `FirstPersonControls` in my code ? #141

Open hasnentai opened 10 months ago

hasnentai commented 10 months ago

Hi @Knightro63 I would like to use FirstPersonControls to rotate my camera on my football field Can you give me an example ? I see a .js file in the jsm but not the dart

For example this is a js example

controls = new FirstPersonControls( camera, renderer.domElement );
controls.movementSpeed = 150;
controls.lookSpeed = 0.1;
Knightro63 commented 10 months ago

Hi @hasnentai,

I have made an example for an fps game and put it in three_dart_jsm originally as games_fps.dart. It can also be found in the forked git repo of three_dart until I have the chance to finish everything and do a pull request.Below is a link to the github location. https://github.com/Knightro63/three_dart/blob/main/example/lib/games/games_fps.dart

This is not the same type of camera controls in the .js file, but it should work for your case.

Hope this helps.

Knightro63 commented 10 months ago

Hi @hasnentai,

I added FirstPersonControls to my three_dart_jsm package.

Please look at the file below for the example. Make sure to run flutter pub upgrade to update to the package. https://github.com/Knightro63/three_dart/blob/main/example/lib/games/games_fps2.dart

Hope this helps.