Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
avatar image
0
Question by chelder · Nov 05, 2015 at 06:23 PM · colliderfirst-person-controlleraccelerometerfalling-through-terrain

Google Cardboard: RigidbodyFirstPersonController script attached to its camera is falling through the floor

I have followed the Checklist: Object or Character is falling through the floor. This problem is different as it only happens with Google Cardboard (5.2).

I have attached RigidbodyFirstPersonController.cs to the Main Camera [1] and played with its options. I also have followed this tutorial which I think uses the old first person controllers.

If I use the keyboard or the mouse to move through the enviroment, it works well. Unfortunatelly, if I use the smartphone [2] it will fall through the floor if I focus to the floor (specially if I'm climbing a mountain). [3]

Other possible workarounds I have done unsucessfully:

  • Increase the radius of the capsule collider or the height. Increasing the height improved it. It was harder to fall through the fall.

  • Change the collider to sphere.

Possible workarounds I have thought, but not try (or I have tried, but I can try harder):

  • Use a character with the third person controller. The camera would follow that character.

  • Doing more modifications of the RigidbodyFirstPersonController script (I did this one)

  • Change some script/s of the Google Cardboard asset, study it deepler to understand how it uses the accelerometer.

  • Untick the track rotation option. Use or code another controller which uses the accelerometer.

I think the above solutions would consume a lot of time. So, do you have some other idea? Did you solve this problem before?


[1] If we attach it to Head, it does not work unless we untick Track Rotation. We need to use the accelerometer to move the camera, so we need to tick Track Rotation (or use another controller to deal with the accelerometer). By the way, the raycast does not work well if I attach it to the Head either: the raycast intersect other objects, but the exit event is called before exiting (even if I use the ignore raycast tag).

[2] Or I use the mouse keeping the Alt button pushed. It is how the movement with the accelerometer is simulated within the Unity Editor.

[3] To make the camera always walking forward, I have modify the RigidbodyFirstPersonController.cs adding a input.y = 1f; as I explain here.

Comment
Add comment
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 Reply

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

Answer by chelder · Nov 06, 2015 at 02:17 PM

So far, the best workaround I have done is the following:

  • Drop to the Hierarchy the prefab coming with the Standard Assets: Characters > ThirdPersonCharacter> Prefabs> ThirdPersonController

  • Add the CardboardHead.cs script to the ThirdPersonController gameobject. Enable track rotation and disable track position.

  • Disable the CardboardHead.cs script from the Head gameobject (I guess removing the Head gameobject would be OK too).

  • Attach the Main Camera as a child of the ThirdPersonController gameobject (that camera should have the left and right camera).

In order to the player is walking forward all the time, I have also done the following modification to ThirdPersonUserControl.cs:

     // Fixed update is called in sync with physics
     private void FixedUpdate()
     {
         // read inputs
         float h = CrossPlatformInputManager.GetAxis("Horizontal");
         float v = 1f; // CrossPlatformInputManager.GetAxis("Vertical");

If we attach the controllers to the camera, it does not work because if we look down, the camera could be above the floor, so the camera would fall through the floor.

However, if we do what it is described in this answer and attach the controllers to another game object, we remove that problem.

Notice we can also use a cube or any other game object with a rigidbody and make it invisible. Doing that, it would be like a first person game.

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

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

31 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

FPS controller prefab and grenade script 2 Answers

Would this work for melee in an FPS? 1 Answer

change first person controller collider to cube 1 Answer

How to stop an object from moving rigidbody 1 Answer

First Person Controller falls through terrain in Windows build 4 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