- Home /
Chain Reaction: Rigidbody that pushes rigidbody that pushes other rigidbody
Hello everybody,
I'm trying to make a "medal game" in Unity. You can see on this video what I'm calling a "medal game": youtube. You can find a description on Wikipedia here in "Pusher game type" section. The aim is to add coins/medals to push others to you. Here is a picture:
So I have medals that have rigid body, and a block, that also has a rigidbody, that pushes medals. This block moves forward and backward with the MovePosition method of the rigidbody.
Problem is that this block correctly pushes medals that are on its way, but these medals don't push other medals that could be also on their way. Medals just merge each other.
Screenshots:
I add medals on the game
Medals are pushed and merge with other medals without pushing them. Nothing moves. No chain reactions.
My solution
I found one trick. For now, I add a script on medals. When a medal enters in collision with an other medal ("OnCollisionEnter"), I add a Fixed Joint component and link these two medals. I remove the component in "OnCollisionExit" method. Now it works.
I don't know if it is the best way or I missed something with Unity. Someone has any idea?
i think u can use IsTrigger in the boxcollider this disables the collision
I don't want to disable the collision. On the contrary I want the collision to work. If I use IsTrigger, medals would fall through the platform. You probably didn't understand well my problem.
not all of us can use you tube, you know. Its blocked on my home computer, and i have no idea what your talking about.
You can find a description on Wikipedia here in "Pusher game type" section. Hope your home computer also doesn't block Wikipedia... The aim is to add coins/medals to push others to you.
Here is a picture:
Answer by ZouBi27 · Sep 12, 2013 at 12:54 AM
Finally, a friend helped me to find the solution. It may seem stupid but the problem was the scaling. Indeed, the medals/coins was too small so collision didn't work. By increasing the scale, everything is perfect. I don't know why but now it's good !
Zou, there are actually may extensive questions about this on this site, have a good search! (always add "fattie" to your serach to get worthwhile results ;-) )
BTW "coindozer" is the usual term for these sorts of games, I guess. (There are 100s of them on the app store.)
http://answers.unity3d.com/questions/318841/what-approach-would-you-recommend-for-a-coindozer.html
it's actually a surprisingly difficult challenge to do well with a conventional physics engine.
Note: "SPHERE" colliders are by far the fastest. simply use SPHERE Colliders (and possibly lock off rotation other than around Z, so they don't tumble unrealistically), it's one of the few situations where you need to worry about performance.
You'll have to correctly use physics layers and other stuff.
Don't forget that normally you "can't really" use that many colliders in a scene! You're killing the PhysX.
Thank you for your reply. In Japan, we call it "medal game" and i've never heard before the word "coindozer". That's why I couldn't find any relative case when I was looking for it.
I was using SphereCollider, but I found that if you are using colliders with a small scale (ex: 0.001), Rigidbody and Physic Engine don't work well anymore. By increasing the scale of my colliders, Everything started to work fine.
You're in Japan ?! Ah fantastic. Tokyo? We only watch NH$$anonymous$$ :) "medal game" thanks for telling me that - good information. That is ABSOLUTELY CORRECT, PhysX fails when scale is small. $$anonymous$$oreover: Essentially, you should really only use, I'd say, a scale of one everywhere. (In general terms.) It's a real gotchya. Your model makers should make everything with real meters and then use real kilograms.
Your answer
Follow this Question
Related Questions
rigidbody collision and forces 0 Answers
Why is this rigidbody not activating the trigger? 0 Answers
Turning an object into a RigidBody and applying a force on it... 2 Answers
Collision problems 0 Answers
Advice for Intersecting Colliders 0 Answers