Hi guys,
Is there any way to make a sticky collider, for example if a person jumps onto a moving (animated) box collider, he should stick to the it and not slip as the collider is pulling away.
I guess non of the built in Unity Physics material support it.
any suggestions?
Thanks
Steve
Unity doesn’t have a “sticky” collider that I know of, but you can approximate the same thing by instantiating a physics joint on collision with the box’s collider. Do a search of past forum threads using the keyword “grab” and you’ll find some ideas how to do it.
thanks bigkahuna,
taking your advice I searched the forums and came across this thread
http://forum.unity3d.com/viewtopic.php?t=1597,
its a good way to attach dynamic projectiles on surfaces by spawning a joint ,
but what i wanted to achieve was for a first person controller to jump on floating logs on a river or on top of a moving bus , but still have the freedom to move on it.
I am trying to figure out something, need more help.
thanks
Steve
I have attached a Unity scene file with assets, it a very simple scene , just need the rotating platforms to actually carry the first person to the next ledge, but still being able to move freely on the rotating ledge.
problem here is that as I jump on to the rotating ledge , the ledge pulls away and drops me on the water.
105189–4035–$sticky_scene_961.unitypackage (930 KB)
If your player is using a rigidbody/physics to move, I think you need to use ridgidbody.MovePosition() to move your platforms.
If you player is using a character controller/kinematic object, I think parenting it to the platform would work. or maybe something like
OnTriggerStay(player) {
player.Translate(DirectionPlatFormIsMoving*Time.deltaTime);
Ok guys,
found in www.unifycommunity.com, it has been up there for so long , i guess i was being too lazy , works like charm , thanks to Yoggy.
http://www.unifycommunity.com/wiki/index.php?title=PhysicsFPSWalker
cheers
Steve.
Hello all (first post for me in this forum)
I am trying to do the same thing here but without success. Would you be kind enough to review my steps and tell me where I miss something. I have a lot of experience with 3D apps but I am new to Unity, I must miss something big…
Here is what I do:
1)open a new scene, get a cube (GameObject>CreateOther>Cube)
2)animate the cube (transform.Rotate(0, 20*Time.deltaTime, 0)
3)get a capsule (GameObject>CreateOther>Capsule)
4)apply a rigidBody component to the capsule (components>physic>rigidBody)
5)create a new script (assets>create>javaScript)
6)paste the PhysicsFPSWalker code in the script, save
7)attach the script to the capsule (drag&drop)
8)play
At this point I have a Capsule falling on the cube. The capsule stops when it hits the cube. I can control the capsule with the keyboard (move, jump, etc). But, when idle, the capsule does not stick to the cube, it falls in the abyss and makes me sad…
Thanks
@Zoro,
I seems what you have done is right, i am trying to figure out why yours isnt working (well I have less idea on codes).
But follow this link on wiki,there is a Zip for download, try using this FPS walker in your project it should work.
I have no idea who is the author of this script is, there wasnt any name on the page.
http://www.unifycommunity.com/wiki/index.php?title=RigidbodyFPSWalker.
Hope it helps
Cheers
Steve
Thank you Steve. The RigibodyFPSWalker script is indeed doing what I need. I think the problem with the PhysicsFPSWalker I tried before is that the capsule just doesn’t inherit the transformation of the parent object (the platform). I started a new thread a few days ago on this subject, the discussion should probably move there:
http://forum.unity3d.com/viewtopic.php?p=109359
Thanks again