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 erazor · Mar 03, 2011 at 05:01 PM · 2d3dside-scrolling

Constraining Physics

I'm currently at the concept stage for a Pseudo 2D Sidescroller. I would like to implement the world in 3D using camera viewing the world from oneside.

I would like to constrain physics based movement of most of the game objects to X, Y by placing them between two (invisible) box colliders like shown below (Top View):

========================================= Back Collider Plane
  Projectile ---> Obj1  Obj2     ObjN
========================================= Front Collider Plane

Would that work reliably or only in theory?

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

3 Replies

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

Answer by kromenak · Mar 03, 2011 at 05:24 PM

On our project, we had initially done this very thing, but it caused a lot of physics glitches and you could never be 100% sure that the objects were lined up in a plane, which can be useful sometimes.

Unity has an object called the "Configurable Joint" which we USED TO use for this sort of thing. It has options for freezing motion and rotation along an axis, though it is kind of a confusing component.

In the last couple versions of Unity (maybe starting with 3.2?) the Rigidbody component has a constraints property. You can use this to freeze movement in the Z direction. You'll probably also want to freeze rotation along X and Y. This is the solution we use and it works fine.

Comment
Add comment · Show 1 · 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 erazor · Mar 03, 2011 at 05:34 PM 0
Share

Ahh great thanks for the info. Perfect.

avatar image
2

Answer by puckipedia · Mar 03, 2011 at 05:23 PM

I Dont think so, saw a game on the mac app store, called Topple Drop, that sometimes falls forward or backward, so x, y and z. i would go into the rigidbody -> constraints settings and choose Z under freeze position ;)

Comment
Add comment · Show 1 · 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 erazor · Mar 03, 2011 at 05:34 PM 0
Share

Ahh great thanks for the info. Perfect.

avatar image
1

Answer by Thom Denick · Mar 03, 2011 at 05:38 PM

My Game Pixel Pig is a 2.5D Pachinko Game. You can play the version on Kongregate here: http://www.kongregate.com/games/ownzilla/pixel-pig

That version of the game has a physics setup like you are describing. The pig is basically sandwiched between two giant block colldiers. You can see he moves slightly forward and slightly backward if you look closely (it's tough to see because of the ortho camera.)

In the iPhone/IPad version I have recently changed to the Lock Z method on the rigid body described in the other two answers. This has basically solved all of my physics problems. Previously I had major issues with the pig getting mixed up with the plunger, locking the pig has solved all the issues I'm aware of. I also have a sneaking suspicion it had a positive effect on performance which is key with fast-moving physics objects. You get weird things happening when your game dips below 10FPS in extreme physics situations. (Only really an issue on mobile platforms.)

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

No one has followed this question yet.

Related Questions

Assets/Scripts/PlayerController.cs(32,49): error CS0126: An object of a type convertible to `float' is required for the return statement 1 Answer

mobile developement 1 Answer

2D object look at 3D object 0 Answers

Unity scene empty but game still runs (beginner) 1 Answer

error CS0664: Literal of type double cannot be implicitly converted to type `float'. Add suffix `f' to create a literal of this type 2 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