Free form rotate
Blitz3D Forums/Blitz3D Programming/Free form rotate
| ||
I've got a bit of code written to rotate the camera as I move the mouse, just like being in a third person game, but only, it's for a map editor. I want to reproduce a Maya or 3dsmax type "perspective" view environment. The problem is, the rotation is wobbly, like it's moving in a sine wave (understandble, but not desirable) I have no clue how to get rid of it, here's a snippet of my code, if you need anymore just yell. :) Thanks. Function UpdateCamera() Mouse_X_Speed#=MouseXSpeed()*0.075 Mouse_Y_Speed#=MouseYSpeed()*0.075 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 Camera_Pitch#=Camera_Pitch#+Mouse_Y_Speed# Camera_yaw#=Camera_yaw#-Mouse_X_Speed# TurnEntity cam_target, Camera_Pitch#, Camera_yaw#, 0 smoothcam(pivot_cam,sphere,2) End Function Function smoothcam(pivot,target,camspeed) curx#=EntityX(persp_cam) cury#=EntityY(persp_cam) curz#=EntityZ(persp_cam) destx#=EntityX(pivot_cam, True) desty#=EntityY(pivot_cam, True) destz#=EntityZ(pivot_cam, True) curx#=curx#+((destx#-curx#)/camspeed) cury#=cury#+((desty#-cury#)/camspeed) curz#=curz#+((destz#-curz#)/camspeed) PositionEntity persp_cam,curx#,cury#,curz# PointEntity persp_cam,target End Function |
| ||
wobbly? Maybe you should use Floats instead of Integer somewhere? (camspeed?). I have also seen some strange Wobble Effects with Sprites which are parented to the camera when the camera is far away from the Coordinate 0,0,0. (it happens sometimes that my player is falling trough the ground while developing the level, and then, maybe 5000 units away from the center it starts shaking strangely) |
| ||
oh, it's like i can move the camera side to side no problem, but when i move it up and down over and under the objects, and also try to move it side by side, it wobbles uncontrollably up and down in a wave motion. |
| ||
What are the dimensions of those Objects? Are they extremly big? How many Blitz Units do you have to go down to be below or above it? |