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 Fattie · Jul 14, 2012 at 06:16 PM · physics

"Padded objects" type collision .. any ideas?

You wake up in a room with padded walls ..

Imagine a 1 meter block colliding with a large wall in Unity. They both have typical say metal-like PhysicMaterials.

In this example, picture SLOW movement and collisions. (Like the spacecraft floating around in 2001...)

Obviously, nothing happens until the moment something touches, and then PhysX correctly provides I suppose

That's all great ... Now imagine if both objects were covered in padding, say about 5 cm or 10 cm thick.

The collision would be quite different (I think??!) - sort of squidgy, slowing down after the padding started to interact.

Has anyone done this. or can think of a good approach, or does it exist already?

My only idea was to: add a manually force field that extends 5+5 = 10 cm from the wall in the example, and ends abruptly. (I guess, implement this simply with yet another collider, as a trigger). Inside that "quantum of rubber padding" I guess you would just simply add a fixed force pushing the cube away {questions arising, would it vary with distance, or not even - how do padded walls behave?}. I suppose, it would slow it down more on the way in and speed it up more on the way out.

An extreme example - imagine throwing a ball towards a very powerful fan blowing air. That would eventually stop the ball and push it away - a kind of a bounce. I suppose, that's sort of like the solution I describe.

Or, would it be best to use the mechanism I describe, just alone without a normal collision?

Or .???

I was also thinking, is it essentially a matter of "delaying" collision. The object comes in, PhysX does everything normally, but it "hangs in space" for a few beats before firing off in the other direction. In fact, does that achieve the right feel?

Furthermore -- in fact, DOES PhysX currently do what I describe? Q, does PX wait until the moment of contact (allowing for the penetration values etc) to apply forces, or, does it start doing them when they cross some threshold and apply them over a small distance? I guess this knowledge would be critical to the issue I am asking about. (if you simply tuned that range to be bigger, that would presumably exactly achieve what I am describing.)

I also thought about arranging it so that the wall is actually a big thing which is spring'd to a real wall behind! Will springs work like that in PhysX, ie, something hitting or perhaps sitting on a object, which has a spring connection, will in fact "work" that spring? forces and events carry through to springs?

thanks for any ideas !

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

2 Replies

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

Answer by Muuskii · Jul 14, 2012 at 06:38 PM

Hi, I was going to work on something similar to this in my project, I just didn't get to the part where it's appropriate to add it in yet. Maybe we could work together on it. I was thinking about using the trigger method with Rigidbody.AddForceAtPosition but then we would have to find the correct position to add the force at. Unfortunately OnTrigger events don't pass contact information like a normal collision event, and we can't use a "turned off normal collision" afaik because it won't throw events.

As far as I heard from someone else on here you could use Collider.bounds Intersects to help get an idea of where you should apply the force. To answer your other sub questions; yes I think the force magnitude should be based on penetration distance that seems accurate for padded walls, just be careful that the triggers don't overlap!

If you get some code working on this I would be glad to swap pms with you on the subject.

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 Fattie · Jul 14, 2012 at 06:51 PM 0
Share

You know, I didn't even think about the issue of "where" to add the force -- actually, I'm not sure if it matters at all ?! (Just add it centrally to the whole object.)

I guess i was thinking more of a padded ball hitting a padded wall -- but you make a superb point, I better start thinking about that :)

regarding solely what you say about finding "where" it hits. depending on the geometry involved, perhaps just stick four small triggers, for example on the corners of a cube (err, 8 on a 3d cube) in that example of a cube, it has to after all hit a corner (if it's a flat wall) so you have the answer from one of those triggers. perhaps that's a way forward regarding that issue solely.

i'll just post the full rig of anything i figure out, no worries

You'd think there'd be a latex engineer on here that can tell us the curve for rubber, what sort of lousy game programmer list is this ?! what else do you do when your job as a latex engineer gets GFC'd other than retrain as a game programmer???

avatar image Fattie · Jul 15, 2012 at 05:58 PM 0
Share

Since sadly nobody else has any interest at all in this question, I have with thanks ticked your answer $$anonymous$$uuskii ! thanks for the thoughts!

avatar image Muuskii · Jul 15, 2012 at 07:14 PM 0
Share

Thank you. I was looking at the intersects function more closely and it seems it doesn't return contact points like I figured it would but I think you're saying that doesn't matter to you. I might have to make a custom script that does it given two colliders . . .

avatar image Fattie · Jul 15, 2012 at 07:19 PM 0
Share

Right - among other things, I definitely want that contact points info you mention. (Don't forget in some situations you could possibly solve that problem just by using my trick of little colliders in the corner).

I am quite interested in the idea of making: WALLS THAT ARE ACTUALLY SPRUNG! $$anonymous$$y early tests are working great !

one thought: say you're a cube at 20 degrees off and you hit a hard wall. of course, one point hits first and that torques the cube vigorously, of course right. IF YOU HIT a "padded wall" there is LESS of that affect, it is much less vigirous. the cube can $$anonymous$$EEP it's 20 degree off, as it moves in to the padding, you know what i mean? that's worth thinking about in terms of "how padding works!

a hard wall - as well as providing instant return - instntly and fully torques objects that are off face line. BUT padded walls do that less.

BTW again it's surprising to me there are not 100 Unity programmers desperate to give an opinion on this! - heh !! thanks again for the brainstorm

avatar image
0

Answer by Muuskii · Jul 16, 2012 at 12:57 AM

I can't believe I didn't think of this before. I'm attaching a project file so you can test out what I've been working on here. Basically what we do is make a Kinematic Rigidbody parented to a non-kinematic one separated out into collision layers so that only the first can collide with the "pad layer" we then use the contact points when the kinematic version collides with the pad to apply forces to the non-kinematic rigid body, thus the object drags through the pad slowly and can sometimes even bounce off it.

I'll need to work on calculating the force to get results more in line with a padded floor, but it certainly illustrates how this is VERY possible to do.

Hope that this has helped you out! :P

P.S. I wonder how you'd do this with a compound collider?

Padded Floor Project


paddedfloor.zip (211.1 kB)
Comment
Add comment · Show 3 · 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 Fattie · Jul 16, 2012 at 06:52 AM 0
Share

Spectacular, gimme a $$anonymous$$ute to look at this !!!!!!!!

avatar image Fattie · Jul 16, 2012 at 06:53 AM 0
Share

TBC, you mean "only the first can " ... you mean the kinematic one collides, gives you the points, and does not actually bounce?

avatar image Muuskii · Jul 16, 2012 at 02:46 PM 0
Share

Yes, because kinematic objects don't get effected by collisions it stays stuck to the non-kinematic one, but! It turns out that it still calls the collision functions when it touches a rigid body collider, giving us the contact points.

It's almost TOO simple and maintainable. :P

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Constraining physics for a buckyball -like simulation. 1 Answer

2D 360 degress platformer example needed 0 Answers

Rigidbodies won't collide if mass difference is too high 0 Answers

Object jumping while moving(with addForce) 0 Answers

Physics.CapsuleCast Help 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