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 /
avatar image
0
Question by superflyninja · Jan 10, 2014 at 10:39 AM · c#first person controllercamera rotationsticky

Help with sticky FP controller script

Hi all, Im in need of some guidance please! I want to create floating levels. They are made up of cubes. I have an FP controller. Say a path is 4 cubes in a row, edge to edge in a straight line, when the player reaches the end of the line of cubes the player will rotate 90 degrees and move onto the adjacent side of the end cube.Then again when the player moves forward they move to the underside of the cubes. I was thinking that I could tag the specific cubes that allow the player to transition to another side. Maybe when the player moves off the edge of such a cube, a check is performed and the player rotated to the new orientation. Any idea of the best way of doing this? Ideally Id want a smooth transition, so a player can stop pressing the movement key at any time and the rotation and movement stops and continues when the player presses the forward key. Cheers :D

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

Answer by HappyMoo · Jan 10, 2014 at 03:56 PM

Get rid of the FP controller. It would need very hacky code to prevent him from falling down. Write your own controller, which also adheres to your new rules, i.e. waking over edges and not being pulled down by gravity etc.

Another challenging part is to know when you can cross edges. It's probably best to configure this on the blocks themselves, but then you need to know on which block you currently are - maybe you're on the last block you touched(Collision). And you need to make sure the corners work... and that if you can cross an edge, but there's a block next to your current block, you actually continue to walk on that block and not rotate around the edge etc.

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 HappyMoo · Jan 10, 2014 at 03:58 PM 0
Share

What happens if you try to walk into a non-rotating edge? You fall off or are you blocked? In case you fall off, what will the gravity be like? In the original direction (-y) or according to the last face you were standing on?

avatar image superflyninja · Jan 10, 2014 at 04:23 PM 0
Share

I use my own FP control script so that should be ok to modify. I If you walk to a non rotating edge then you are blocked. I found the walking on walls script here: http://answers.unity3d.com/questions/155907/basic-movement-walking-on-walls.html and I converted it to work with my controller in C# but 90 degree angles are not handled. I suppose I could use two planes with no rendering components to at the edge of the cube at right angles to one another to signal start and stop of rotation. Use lerp then to rotate around the edge?

avatar image HappyMoo · Jan 11, 2014 at 08:43 AM 0
Share

When entering the edge, save some values like the edge position, the two planes the edge is between etc - what your script needs to do the animating, then set your players state to walkingOnEdge... And while you are in that stage, only allow right/left movements along the edge, but block at the sides of the edge and turn forwad/backward movement in a turn around the edge

avatar image superflyninja · Jan 13, 2014 at 11:10 AM 0
Share

Hmm yup.Id imagine Id need to use a probe to check if approaching edge. $$anonymous$$aybe do a raycast in the down dir from the very front of the player collider. If I keep the world cube based then can just presume there is a cube to rotate to. There is more to this control scheme than meets the eye.

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

19 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Refin' another script in relation to speed, and not tacking from using the Update? 1 Answer

[C#]Angle of shooting equale to mouse direction 1 Answer

Character getting stuck on curbs.. 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