So Thaumaturge gave me some basic code that uses ‘quat’ to move the camera forward/backward.
However, I still do not know how to strafe. How?
Pay attention to the useful section with the code.
Apropos of the recent discussion of providing new samples for the engine, I’ve put together a simple third-person camera controller.
Now, I don’t often play games that use this sort of camera, I fear, so it’s very possible that there are cases that I’ve missed. And, well, it is a simple implementation.
Nevertheless, perhaps it might prove useful!
It also comes with a very simple demo-program, showing how the camera works.
You should find both the controller and the demo in this repository:
Below is an example of a free camera.
Control:
Hold down the right mouse button.
Move buttons : W - forward , S - backward , A - left , D - right , Q - up , E - down , Shift - Accelerate ,
mouse wheel - speed.
Example of use:
import direct.directbase.DirectStart
from camera import CamFree
environ = loader.loadModel("models/environment")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(-8,42,-10)
CamFree()
run()
camera.py
from direct.s…
1 Like
thanks for the help but i just noticed a bit of code in my program was working that i thought was not working (quat.getRight()
), so I just used a minus number and put that onto the left function.
1 Like