I cant get onto the B3D beginners area forum so...

Community Forums/General Help/I cant get onto the B3D beginners area forum so...

Captain Wicker (crazy hillbilly)(Posted 2012) [#1]
Hello,

Anyone know how to control the camera using the mouse or touchpad in bb3d? Also, am I the only one not able to get onto the beginners area forum?


Matty(Posted 2012) [#2]
Have a look through the code archives under "user input" - should have plenty of examples.


D4NM4N(Posted 2012) [#3]
MoveEntity
MouseX
MouseY


There you go.


_PJ_(Posted 2012) [#4]
Forums are working fine for me...

Try exiting your browser completely, clearing your cache (esp. cookies and stored pages), and refreshing the page.


Captain Wicker (crazy hillbilly)(Posted 2012) [#5]
clearing your cache

Yes! That finally worked! Thanks! :)


ando(Posted 2012) [#6]
(salute) G-day Cap, I've been a beginner for over 20 years and always will be. If you're game enough then check out the way I've settled on. :)

PS- with this method the player won't slide sideways on slopes.
mxs = MouseXSpeed()
mys = MouseYSpeed()
xpos=-mxs
ypos=mys
	
If ypos>4 Then ypos=4                                        ; limit speed
If ypos<-4 Then ypos=-4

yv#=EntityY(man1)-many                                    ; man1 is a pivot

many=EntityY(man1)
	
If KeyHit(57) yv=4                                                  ; jump

MoveEntity man1,0,yv-.1,0                                  ; gravity

TurnEntity camera, ypos, 0, 0                            ; camera is not a child of man1
TurnEntity man1, 0, xpos, 0

RotateEntity camera ,EntityPitch(camera), EntityYaw(man1), 0

If EntityPitch(camera)>80 Then TurnEntity camera,-5,0,0         ; set limits for up and down rotation
If EntityPitch(camera)<-80 Then TurnEntity camera,5,0,0

If MouseDown (2) Or KeyDown (200)=1             ; forwards
   MoveEntity man1,0,0,1.4
EndIf

If KeyDown (208)=1                                                ; backwards
   MoveEntity man1,0,0,-1.4
EndIf

PositionEntity camera, EntityX(man1),EntityY(man1)+10,EntityZ(man1)
MoveEntity camera,0,0,5                                      ; move camera in front of model


Last edited 2012


Captain Wicker (crazy hillbilly)(Posted 2012) [#7]
Very nice camera movement ando, I had been working on an FPS but instead of camera/mouse control I had used the WSAD keys and Left and Right cursor keys for rotation. Your code helps out a lot! :)
@Malice, When did you become _PJ_?


ando(Posted 2012) [#8]
Glad you like it. You may have already spotted this but I was looking at the code and realised that you would probably have to check for collision with the terrain before allowing the jump to function otherwise jump would really be a fly mode. :)

Last edited 2012


Captain Wicker (crazy hillbilly)(Posted 2012) [#9]
already spotted this

lol i did :P