Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
This post has been wikified, any user with enough reputation can edit it.
avatar image
2
Question by Ozone Developer · Dec 23, 2014 at 02:33 PM · playermousebeginnertutorialturning

Why is my Player game object not rotating with mouse movement in 'Survival Shooter' unity project

I'm a beginner to Unity trying to learn the ropes by taking the tutorial courses hosted here on the site.

I'm on the 9th phase of the course and have worked without any hitches so far.

However I downloaded the standard assets folders from the asset store this morning and on returning to the survival shooter scene on my PC found a couple of game object had their tags removed and the Player object no longer responds to mouse movement.

Please what may have gone wrong and how do I get the player to follow the mouse again?

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SaraCecilia · Dec 23, 2014 at 01:22 PM 0
Share

Do you have any other GO's with attached scripts for mouse input control that are interfering? What happens when you retag your GO's? I'm presu$$anonymous$$g you imported this asset bundle into your current project

avatar image AlexDemon01 · Mar 24, 2015 at 07:34 AM 0
Share

Please help me!!! I have the same problem and I checked all the layers, but they were all correct! Do you think that you know why? please let me know!

avatar image junesxing · Jul 13, 2015 at 06:14 PM 0
Share

I'm another beginner with the same problem. Using the debug.log function, I have narrowed down the problem (I think) in my script to the if statement in the turning function: if(Physics.Raycast (camRay, out floorHit, camRayLength, floor$$anonymous$$ask)) I put a debug.log within this if statement and it is never accessed. Looking at the variables being passed it, they all seem to have values except for floorhit wich I can't seem to reference with the debug statement).

Any suggestions?

avatar image john_harter · Mar 31, 2016 at 04:13 PM 0
Share

Thanks deepak_gamer. Using a Floor layer fixed my mouse problem.

avatar image omer897 john_harter · Apr 08, 2017 at 12:35 PM 0
Share

How ? Please guide me

avatar image lokesh90 · Sep 29, 2016 at 06:05 AM 0
Share

In the Player$$anonymous$$ovement Script Just change it if (Physics.Raycast(camRay, out floorHit, floor$$anonymous$$ask))

With if (Physics.Raycast(camRay, out floorHit, camRayLength, floor$$anonymous$$ask))

9 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by Ozone Developer · Dec 24, 2014 at 07:18 AM

Thanks Sara, the problem was that the floor quad of my scene lost its layer when I imported the new assets to the scene. Correcting that solved the problem. Thanks :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
9

Answer by kevinmorrisone · Jul 18, 2015 at 07:41 AM

12 Days in and boy does my head hurt... =O)

Pretty unoriginal but I am just adding to this (i.e. no credit except my amazing screenshot) cuz it was annoying me AND I didn't import assets or mod the script as someone else found....soooooo...something seems to be toggling the behavior. In any case, if you are in the "Survival Shooter" Tutorial and lost your playerToMouse click on the Game Object Floor under Hierarchy and check the Layer drilldown is set to Floor.

alt text


1.jpg (30.8 kB)
Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image deepak_gamer · Jul 25, 2015 at 04:38 AM 0
Share

I downloaded the assets too, but i dont know what i did and the user defined layers are not being listed in the layers list. Hence i added a new layer named "Floor" and tagged the quad to the layer "Floor". But that is not working; the player is not rotating with the mouse. Is there any particular bit value or something that i have to set to the newly created layer ?? Please help me..

avatar image markus2b · Dec 18, 2016 at 09:43 PM 0
Share

Thanks $$anonymous$$morrisone for that beautiful screenshot!

avatar image alek09 · May 18, 2017 at 07:30 AM 0
Share

Thank you so much; that was exactly my problem.

avatar image SageVerdurousSeaTurtle · Dec 12, 2017 at 03:11 PM 0
Share

thanks kevin... I must have confused the tag for the layer >.>

that is a beautiful screenshot!

avatar image
2

Answer by Realist39 · May 17, 2016 at 10:18 PM

Had the same problem. Deleting the FLOOR object, and then creat it again, helps ME.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image omer897 · Apr 08, 2017 at 12:46 PM 0
Share

Thank dear ... it WOR$$anonymous$$S

avatar image akhayatti · Aug 06, 2017 at 08:34 PM 0
Share

This is very weird but indeed, removing the floor and adding it again made it work! $$anonymous$$agic!

avatar image
0

Answer by ThunderNoji · Oct 02, 2016 at 08:37 AM

I had the same problem and I solved it (maybe)!

Change "Main Camera" direction . - Rotate Main camera and Look down Player.

Good luck.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by xela8888 · Jan 25, 2017 at 08:11 AM

This is my turning function and it seems to work fine:

     void Turning() {
         Ray cameraRay = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit floorHit;
         
         if (Physics.Raycast(cameraRay, out floorHit, cameraRayLength, floorMask)) {
             Vector3 playerToMouse = floorHit.point - transform.position;
             playerToMouse.y = 0f;
             
             Quaternion newRotation = Quaternion.LookRotation(playerToMouse);
             playerRigidbody.MoveRotation(newRotation);
         }
     }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

TopDown Look at mouse 0 Answers

Inventory System - picking up items 0 Answers

Scripting Approach to Mouse interaction 0 Answers

Why Does My Cube Player rotate 180 degrees when I start My game? 2 Answers

FPS Microgame camera moving without input 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges