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 /
This question was closed Oct 06, 2014 at 12:25 AM by robertbu for the following reason:

Design/discussion question

avatar image
0
Question by jester-race · Oct 06, 2014 at 12:24 AM · frictionmoving platform

Moving platform and friction problem

Hey all. I know there's a ton of moving platform questions, and I have read just about all of the questions/answers that came up in my "moving platform" search. None of the proposed solutions have worked for my 2D platformer, and it's probably because my moving platforms can also become controllable characters.

In my game, there are at least three characters that the player can control, using a button to cycle between them. All of the characters are (0.34,0.39) in size-- nearly square. They're small because the original sprites were only 16x17 px and I have not yet adjusted the scale. This is the behaviour I'm shooting for:

Selected character

  • The selected character is under direct control of the player. You can move left and right, and jump. That's pretty much it.

  • The player needs to be able to jump against walls without sticking to them. The way that I've decided to handle this is by attaching a PhysicsMaterial2D to my "Player" with zero friction. This is likely part of my problem, but I couldn't find a better solution.

  • The selected character should be able to walk and jump on any !selected player. I'm using a transform object to detect the layer of objects beneath my player. It will constantly return "true" if the "Player" layer is a part of the layer mask, so I unchecked that layer. Of course, then you can't walk/jump on other players. To get around this, I created two separate layers: "SelectedPlayer" and "NotSelectedPlayer".

  • The selected character should not be weighed down by character stacked on top of it. I expect that this will require some conditional adjustment of either the top characters' mass or the selected character's maximum x-velocity.

Not selected player

  • Should not be pushable by the selected character if the selected character bumps into it.

  • If on top of another character (it doesn't matter if the bottom character is selected or not), the !selected character should ride the bottom player, maintaining its x-position relative to the bottom character.

  • If the selected character walks through a tunnel that isn't high enough for the riding character to get through, the riding character should be peeled off.

Something that might solve part of the problem is if I could get the velocity of the bottom character with a raycast or something, and set the x-velocity of the top player (provided that it is !selected) to the x-velocity of the bottom player in the Update function.

I hope I've explained that well enough. I'm new to Unity, but I feel like I'm getting the hang of it, despite the frequent bumps I've encountered. If anybody has some suggestions, I would greatly appreciate it. And please ask if you need more detail.

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

  • Sort: 
avatar image
0

Answer by robertbu · Oct 06, 2014 at 12:26 AM

I see the answers to this question being a discussion rather than a single specific answer. We ask that design questions be posted to Unity Forums. If you do post on the forums, I suggest you add a comment with a link from here to the forum question. That way anyone wanting to follow or participate in the discussion can find your forum question.

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 jester-race · Oct 06, 2014 at 12:36 AM 0
Share

Ah, alright. Sorry about that. I've created a thread in the "2D" forum section, here: http://forum.unity3d.com/threads/unique-moving-platform-problem.272419/

avatar image robertbu · Oct 06, 2014 at 12:40 AM 0
Share

No reason to be sorry. And after you get your general design questions answered, we'll be here for your specific questions.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Object always falling off moving platform 2 Answers

How to make moving objects stack, without sliding over each other? 0 Answers

How come setting higher mass don't create more friction ? 2 Answers

why is my angular velocity slowing down? 1 Answer

wheels without a slip 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