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 taddmencer · Aug 19, 2011 at 05:08 PM · collideripadaccelerometertiltinput.acceleration

iPad: accelerator tilt breaks collider

I'm working on designing an iPad game in which the player tilts the ipad in order to move around the map.

I found this: http://unity3d.com/support/documentation/Manual/Input.html

It does EXACTLY what I needed.

Now, here is the problem.

When ever I this script I get an issue where the collider's are ignored. Using a very basic example, I made a sphere with a sphere collider and attached a padtilt.js to it. Then I made some walls (with colliders) and a plane (with colliders).

The sphere will stay on the plane, but when I get to a wall it completely ignores and passes through.

I've added rigidbody to the walls and that works, but of course the walls bounce all around. I can add the rigidbody to the sphere, but that doesn't help and make the sphere act all wonky (with or without gravity).

Any thoughts?

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
0

Answer by taddmencer · Aug 19, 2011 at 06:57 PM

I think I figured this out.

Create an empty game object and put your player within that object. Make sure they're on the same XYZ.

IN the object give it a Character Controller and put the tilt script that I mention attached to that empty object.

On the player object (in my case, a sphere) make sure it has a sphere collider and mesh renderer (default) and add a rigid body with gravity off.

This worked for me. I'm doing a top down pinball like proof of concept, this seems to have worked.

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 taddmencer · Sep 06, 2011 at 07:18 PM 0
Share

Eh no. That didn't work like I thought it did. I faked myself out.

avatar image
0

Answer by taddmencer · Sep 06, 2011 at 07:10 PM

Ok, so .. still having issues.

What I'm attempting here is a 2D side scroller. When I tilt an ipad left or right, the character moves. Tap the lower right, the character jumps.

Initially no problem. HOWEVER, the only collider that works is when a flat object us being used for the "floor" or the Y axis .. so, if I walk to the X of an object, my character will waltz right through. HOWEVER, the character can jump on top of the object, say a regular cube with a box collider.

The script I'm using for the tilt seems to be the culprit though with my limited coding brain power I can only stick my tongue out at it in frustration.

Here is the code:

 var speed = 20.0;
 function Update () {
     var dir : Vector3 = Vector3.zero;
     dir.x = -Input.acceleration.y;
     if (dir.sqrMagnitude > 1)
         dir.Normalize();
     dir *= Time.deltaTime;
     transform.Translate (dir * speed);
 
 }

As you see, nothing crazy.

I'm using the prefab Dual TouchPads that come with the 'Standard Assets (Mobile)' and I just disable the left movement controller to use ONLY the pad tilting.

I'd really appreciate any help, thoughts or insults on this ... I'm feeling mildly retarded here.

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 em2 · Sep 07, 2011 at 11:24 AM 0
Share

Hi taddmencer, I haven't gone through the code but I experienced a similar problem doing a variation on a rollaball. It turned out that the physics was going to 'sleep' on my ball, so I had to add an add force of 0,0,0 to it. Although the force was zero, it did keep the physics awake on the ball and fixed the unusual collision problems I was having. Probably not the solution but just something you could try. Cheers Chris

avatar image taddmencer · Sep 07, 2011 at 01:24 PM 0
Share

Ok, I added a constant force to my player (which also added a rigidbody) and that actually caused the character to drop completely through the course. I remove gravity from my rigid body and that didn't help either.

I'll have to look some more and see if there is something more along this sleeping physic path.

Thanks for pointing me in a direction!

avatar image
0

Answer by taddmencer · Oct 04, 2011 at 08:59 PM

OK, I've not figured this out. I can't get any meshes that are imported to accept a collider IF I'm using this accelerator input script provided by Unity. And only the top of a box mesh will register a collider on a pre-generated cube within Unity itself.

Not sure what to do at this point in regards to this. The higher-ups in my company want to see this work, so do I. But sadly nothing yet.

If anyone has any ideas, let me know. Otherwise ... back to the drawing board!

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Input.acceleration reading Issue 1 Answer

Smooth tilt accelerometer 1 Answer

Accelerometer angle limit 1 Answer

My object moved even i havent tilt my phone... 0 Answers

Moving object with tilting the device. 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