Page 1 of 3 123 LastLast
Results 1 to 10 of 29
  1. #1
    Join Date
    Feb 2003
    Location
    UK
    Posts
    1,720

    3rd Person Character System, pt. 2 woes, my script is not responding to the mouse?

    I have Been following along with the "Simple Camera and Camera Control" videos and as I do not have the "programming gene" I have a problem.

    I am past the creation of a camera if one doesn't exist and the script works like a charm. The lookat part of the code works too. So at least I have done that part right.

    I have been through the videos S02_20 to S02_23 now three times and as far as I can tell the code looks fine and there are no errors if I build it either. But nothing happens at all? I do not get any controls from my mouse. The character works fine and I can move him around but I get no input from the mouse at all. Now my mouse works fine so I know it's not that and I have even tried shutting down Unity and re-launching it again but that did not help.

    I don't what else to tell you so I will say that I am using the free version of Unity and I am using VS 2008. So I am hoping that someone will either be able to say "Yeah I had that problem and here is how to fix it". I warned Buzz how bad I am at coding and it looks like I am proving it now, sigh.

    I would appreciate any help you guys can give me.
    Intel i7 x5960 @ 4.6GHz (8 cores) | Asus Titan X x2 + MSI Titan X x2 | Asus ROG Rampage V Extreme | 16Gb Corsair Quad Ram | 1 BuRay Writer | 4 x 1TB HD's | Asus PB287Q 4K Gaming Monitor + Dell 24" Monitor | 1500W PSU | 150 Mbps Internet with NTL | Win 10 64 | My Home Page

  2. #2
    Join Date
    Jun 2008
    Posts
    1,088
    Well I don't know... I took a look at the project again and there is really nothing too it other than the scripts. Only thing I can think of off the top of my head is that you may have over looked a line of code. Or you didn't use the exact values they used and you have your smoothing or another variable too high where the mouse controls are being filtered out? I don't know if you remember when he was doing the middle wheel button it was really hard to get it to zoom in at first, it was because his value was too high. Maybe something along those lines... (Sorry, just shooting in the dark to try and help.)

    -Dane
    You know you want to!

  3. #3
    Join Date
    Feb 2003
    Location
    UK
    Posts
    1,720
    I know what you mean but every time I look through the code I cannot see where I went wrong. As the expression goe I cannot see the trees for the forrest.
    Intel i7 x5960 @ 4.6GHz (8 cores) | Asus Titan X x2 + MSI Titan X x2 | Asus ROG Rampage V Extreme | 16Gb Corsair Quad Ram | 1 BuRay Writer | 4 x 1TB HD's | Asus PB287Q 4K Gaming Monitor + Dell 24" Monitor | 1500W PSU | 150 Mbps Internet with NTL | Win 10 64 | My Home Page

  4. #4
    Join Date
    Mar 2004
    Location
    South Australia
    Posts
    99
    stupid reply here but...are you holding down the Right Mouse Button, if you scripted that part in.

    if thats not it then i wonder if the problem is in the....
    void GetLocomotionInput()

    Ive just finished the videos and it all worked for me.
    The only problem i found is that if the targetLookAt isnt found, the code makes one at the center and not perented to the player.
    Last edited by reclaimer2000; 02-06-2011 at 01:28 AM.

  5. #5
    Join Date
    Nov 2003
    Posts
    1,191
    Pay particular attention to the simplest typing mistakes, for example
    x_MouseSensitivity
    X_MouseSensitivity

    when you eyes are tireds you may not notice that one x is lower case and the other uppercase.
    Try to double click on the variable name so it gets highlighted and make sure other line of code that use the same variable are also highlighted this means you are using the exact same word, for example I did have this mistake in my code where somewhere in the program I used x_MouseSensitivity instead X_MouseSensitivity (or a similar issue can't remember now). Your code will still compile even if this error is present

    In monodevelop I can RightClick a variable and select Find References, this will list all the lines of code that make use of that variable, this way I can make sure that variable is used correctly. I know IDE writes this things for you but some time, some mistake like this for some reason ends up in your code


    or things like this:
    //The RMB is down get mouse Axis input
    mouseX += Input.GetAxis("Mouse X") * X_MouseSensitivity;
    mouseY -= Input.GetAxis("Mouse X") * Y_MouseSensitivity; //HERE it should be ("Mouse Y")
    some time when you copy and paste a line you may leave behind some letter you forgot to change. I had this same mistake

  6. #6
    Join Date
    Apr 2007
    Location
    Seattle
    Posts
    214
    Quote Originally Posted by HokutoTC View Post
    //The RMB is down get mouse Axis input
    mouseX += Input.GetAxis("Mouse X") * X_MouseSensitivity;
    mouseY -= Input.GetAxis("Mouse X") * Y_MouseSensitivity; //HERE it should be ("Mouse Y")
    This is exactly the mistake I had too. It was annoying to try and track down and I got no mouse movement at all from this little typo.

  7. #7
    Join Date
    Feb 2003
    Location
    UK
    Posts
    1,720
    Thanks guys but I am thinking that the error lies in the TP_Camera script and as I cannot get a working copy off anyone I may just delete it again and go through the videos. If I ever get this working I hope somewhere that I can find out the where the error is otherwise I won't learn from the mistake.

    I know how easy it is to make these typing mistakes and I am sure the scripts are fine. So I will just have to grind my teath and do go throught the videos for the fourth time.
    Intel i7 x5960 @ 4.6GHz (8 cores) | Asus Titan X x2 + MSI Titan X x2 | Asus ROG Rampage V Extreme | 16Gb Corsair Quad Ram | 1 BuRay Writer | 4 x 1TB HD's | Asus PB287Q 4K Gaming Monitor + Dell 24" Monitor | 1500W PSU | 150 Mbps Internet with NTL | Win 10 64 | My Home Page

  8. #8
    Join Date
    Feb 2003
    Location
    UK
    Posts
    1,720
    Quote Originally Posted by reclaimer2000 View Post
    stupid reply here but...are you holding down the Right Mouse Button, if you scripted that part in.

    if thats not it then i wonder if the problem is in the....
    void GetLocomotionInput()

    Ive just finished the videos and it all worked for me.
    The only problem i found is that if the targetLookAt isnt found, the code makes one at the center and not perented to the player.
    Yes I am holding down the right mouse button and the part of code that makes the "targetLookAt" if it does not exist works fine.
    Intel i7 x5960 @ 4.6GHz (8 cores) | Asus Titan X x2 + MSI Titan X x2 | Asus ROG Rampage V Extreme | 16Gb Corsair Quad Ram | 1 BuRay Writer | 4 x 1TB HD's | Asus PB287Q 4K Gaming Monitor + Dell 24" Monitor | 1500W PSU | 150 Mbps Internet with NTL | Win 10 64 | My Home Page

  9. #9
    Join Date
    Feb 2004
    Location
    United Kingdom (South)
    Posts
    991
    If you do manage to solve it and keep a copy of your original attempt you could try doing a text comparison between the two. I haven't had a look at it yet but searching google I came across a comparison tool that might help with that task. At least then if you find no solution in your original code you can find the problem when you've rewritten it. http://winmerge.org/

  10. #10
    Join Date
    Feb 2003
    Location
    UK
    Posts
    1,720
    Thank you all for taking the time to try and help with this problem. Well they say 4th time is a charm and now it all works great.

    Hey Avace I use a text editor called Context and that has a compare in it too. But here's the thing I have kept the faulty script, which was the TP_Camera one, and I have looked through the working script comparing it to the faulty one. To be honest I cannot find the problem. The only thing I can think of is that maybe there is a space or tab in the wrong place because they look the same to me.

    Thank you all again for all the advice and I want to thank FatGav who was kind enough to spend some time with me on Skype. I guess this is the biggest thing I like about 3D Buzz, there's always some here to help

    Thanks guys
    Intel i7 x5960 @ 4.6GHz (8 cores) | Asus Titan X x2 + MSI Titan X x2 | Asus ROG Rampage V Extreme | 16Gb Corsair Quad Ram | 1 BuRay Writer | 4 x 1TB HD's | Asus PB287Q 4K Gaming Monitor + Dell 24" Monitor | 1500W PSU | 150 Mbps Internet with NTL | Win 10 64 | My Home Page

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •