three_dart icon indicating copy to clipboard operation
three_dart copied to clipboard

How can I use `FirstPersonControls` in my code ?

Open hasnentai opened this issue 2 years ago • 2 comments

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;

hasnentai avatar Sep 03 '23 18:09 hasnentai

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 avatar Sep 03 '23 19:09 Knightro63

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.

Knightro63 avatar Sep 05 '23 01:09 Knightro63