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 Digital-Phantom · Feb 16, 2015 at 02:06 PM · physicsfps controllerslopephysicmaterialice

How to Implement an 'Icy' slope effect on the FPS Controller

After a little reading it seems that the unity FPS controller does not react to the physic materials. So how would you go about creating the effect of the player sliding down an icy slope ?

???

Comment
Add comment · Show 5
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 awplays49 · Feb 16, 2015 at 02:47 PM 0
Share

Have you tried messing around with rigidbody.velocity?

avatar image Digital-Phantom · Feb 16, 2015 at 04:05 PM 0
Share

Unfortunately the standard FPS Controller doesn't contain/use a rigidbody component.

avatar image melkorinos · Feb 16, 2015 at 04:27 PM 0
Share

Did you add the physic material to the ground and not on the player? You could do that, or then check when the player is on the icy terrain and everytime you inputs a movement , AddForce that will incrementaly become 0 with $$anonymous$$Athf.Lerp to simulate icy effect. Idea of the top of my head.

avatar image Digital-Phantom · Feb 16, 2015 at 04:46 PM 0
Share

Hmm.. was thinking maybe add a rigidbody component to the FPS Controller set it to inactive/disabled. Add the ice physics component to the slope and a collider/trigger.

Then when the player touches the slope have OnTriggerEnter function enable the rigidbody and disable the FPS Controler script.

???

avatar image melkorinos · Feb 16, 2015 at 05:53 PM 0
Share

Let me know how it goes , i have no idea if it works :P

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Noah Dyer · Feb 16, 2015 at 08:31 PM

I would probably create "ice" colliders just above the ground in icy areas, and either give them a specific name, tag, or layer. Then in my player OnCollision, I would check if the collider, matched my ice colliders, and there I would simulate ice physics.

Alternatively, you could capture the playerObject from OnCollision on the iceObject, and run the simulation there.

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 Digital-Phantom · Feb 17, 2015 at 02:24 PM 0
Share

Ok, in theory I've almost solved this.

If you add a rigidbody component and a capsule collider to the 'First Person Controller', then disable the 'Character $$anonymous$$otor Script' your player will be affected by physic objects (in this case Ice)and slides down the slopes perfectly. Even slides a little further than the end of the slope, I'm guessing due to momentum (which is a nice little effect I hadn't planed on)

Once off the slope/Icy surface just re-enable the 'Character $$anonymous$$otor Script', then disable the rigidbody component and capsule collider and you're good to carry on.

So far all this has been done manually in the inspector, so now just need to code some script to do this OnTriggerEnter/OnTriggerExit are activated.

(any help on this part would be appreciated)

avatar image melkorinos · Feb 17, 2015 at 03:22 PM 0
Share

Should be something like this, inserted in the player script

 //Variables
 Character$$anonymous$$otor cm;
 CapsuleCollider cc;
 //Start function
 in Start (){ cm = GetComponent<Character$$anonymous$$otor>();
             cc = GetComponent<CapsuleCollider>();}

 // The trigger enter function
 void OnTriggerEnter(Collider other) {
         if (other.tag == ice)
 {cm.enabled = false;
 cc.enabled = false;
 }
     }

Regarding the rigidody i suggest you take a look here and figure out what you want exacly cause it gets trickier.

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

22 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

Related Questions

Apply physics material to a third person character? 0 Answers

DragRigidBody: Use mouse instead of camera position 0 Answers

Unity physics - how to make an object with a box collider and a rigidbody slide across a slightly undulating surface 0 Answers

How to create icy floor? c# 1 Answer

Making objects slide 1 Answer


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