November 25, 2020, 04:21:41 AM

### Author Topic: [bb] Simple 3D Mouselook by slenkar [ 1+ years ago ]  (Read 563 times)

#### BlitzBot

• Jr. Member
• Posts: 1
##### [bb] Simple 3D Mouselook by slenkar [ 1+ years ago ]
« on: June 29, 2017, 12:28:41 AM »
Title : Simple 3D Mouselook
Author : slenkar
Posted : 1+ years ago

Description : Easy mouselook for a 3D entity

Code :
Code: BlitzBasic
1. Function Mouselook(entity)
2.
3. my=MouseXSpeed()
4. mx=MouseYSpeed()
5. my=my*-1
6.
7.
8. TurnEntity entity,mx,my,0
9.
10. End Function

Dabbede(Posted 1+ years ago)

Why not
Code: [Select]
`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:
Code: [Select]
`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 == BADEnd Function`In any case, it's cool that you're sharing. [/i]