[bb] Simple 3D Mouselook by slenkar [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:41

Previous topic - Next topic

BlitzBot

Title : Simple 3D Mouselook
Author : slenkar
Posted : 1+ years ago

Description : Easy mouselook for a 3D entity

Code :
Code (blitzbasic) Select
Function Mouselook(entity)

my=MouseXSpeed()
mx=MouseYSpeed()
my=my*-1


TurnEntity entity,mx,my,0

End Function


Comments :


Dabbede(Posted 1+ years ago)

 Why not
my=-MouseXSpeed()??


N(Posted 1+ years ago)

 And how come no smoothness in the movement?  It'd be very easy to add, just like this:Global gMXSpeed#,gMYSpeed#,gMSpeed#

;; It's your job to reposition the mouse each frame if you so desire to.
Function SmoothTurn(Entity,PitchMax#=80)
gMXSpeed = gMXSpeed*.9 - MouseXSpeed()*.2
gMYSpeed = gMYSpeed*.9 + MouseYSpeed()*.2
AX# = EntityPitch(Entity)
AY# = EntityYaw(Entity)
AX = AX + gMYSpeed
AY = AY + gMXSpeed
PitchMax = Abs(PitchMax)
If Abs(AX) > PitchMax Then
If AX < 0 Then
AX = -PitchMax
Else
AX = PitchMax
EndIf
EndIf
RotateEntity Entity, AX, AY, 0 ;; ROLL == BAD
End Function
In any case, it's cool that you're sharing. [/i]