- Home /
Object not moving with ground with physics material.
So I basically have 2 objects, one being the hero on a snowboard with that snowboard being used to check different grounds it is sliding over or to activate triggers. The other being a circle shaped magnet that is rotating.
The result I'm trying to get is when the hero enters the trigger of the magnet it gets attracted to the magnet. When it's stuck to the floor of the magnet it should rotate together with the magnet. I got everything working except for the rotating part. The hero is stuck to the magnet but stands still on one position with the magnet rotating underneath the board.
So a bit more in detail. the board has a rigidbody component and underneath (child) a gameobject with a capsule collider so I would be able to check if it enters the collider of the magnet.
The magnet has 2 gameobjects underneath it. One with a collider that works as a trigger and the script for attraction where I change the gravity of the world into a point gravity towards the magnet calculated with the position of the hero and position of the magnet when entering the trigger. The other gameobject is a ragespline that holds a physics material with static friction so it won't slide over the circle and in my opinion should drag the hero along when rotating since it actually does prevent the hero from sliding, but the dragging along doesn't work.
I have tried modifying the physics material, modifying the rigidbodies drag and angular drag. But nothing seems to work to get the hero to rotate with the magnet. Anyone who has an idea or can help me out?
Answer by Dblfstr · Mar 25, 2014 at 02:42 PM
If you are moving the magnet by its transform.position, there will be no collision interaction. You have to use forces to move rigidbodies. It sounds like your magnet or ragespline (whichever needs to 'move' the player) needs a rigidbody and its movement should be controlled by AddForce, or AddTorque, etc.
I actually read this already when searching before asking this question. But the AddTorque didn't seem to move or have an effect on my magnet at all. I'll give it another go and keep at it till the thing is moving with AddTorque.
Glad it worked. If the questions is adequately answered, please mark it as such and close it. :D
Little grey circle with a checkbox in it underneath the thumbs up/thumbs down.