Last Camera python =Þ

Hey. :yes:

Here are my last 2 questions and then my camera script will be completed. :stuck_out_tongue:

  1. I use the script in a Rpg game… But as you know in every Rpg you need to use your mouse. The problem is… I added showMouse. And I see the mouse moves to the center of the screen every time…

I tried deleting this at the bottom of the Camera_Mouse_Look script:

r.setMousePosition(r.getWindowWidth()/2,r.getWindowHeight()/2)

r.setMousePosition(r.getWindowWidth()/2,r.getWindowHeight()/2)

But when the mouse moves away from the center it starts rorating very fast.

  1. The camera is now parented to the Cube. Can anyone make that the camera moves behind the cube when a key is pressed. So that you can see the character from the back?

Attachments

Camera test.blend (873 KB)

Hi gamemaster,

Here is a tutorial that may help you.

“3rd Person Camera Collision Detection”

http://www.blending-online.co.uk/8501/49279.html

Hm… I don’t think so. That’s what I already have but without the camera rotating.

Well . . . there are two other things I can think of, but they may not be what you are trying to achieve. First, you could move the r.setMousePosition(…) line to be indented inside the “if” block before the else statement. ( And get rid of the second r.setMousePosition(…) line since it is just a duplicate) That way the mouse wouldn’t be locked to the center except when the mouse button is held down when you are mouse looking.

Second, if you wanted to always lock the camera behind the character, you could comment out all the lines that have posx or lmotion in them. That way the camera won’t move side to side at all, just follow from behind.