- Home /
Colliders not working when rotating
Hi. I am trying to make an object that has a script attached that rotates it. I want it to be able to colide with objects and push them around but it seems to just go right through the object. I have tried making it static, trigger, ect and can't seem to find a solution.
I tried using both a mesh collider and cube collider as well as trying out a rigidbody with kinimatic turned on and off as well as gravtity.
it could be a number of things, 1. You're using 2D and need to use 2D Colliders but you're using 3D colliders (or vice versa) 2. your colliders are triggers and won't collide 3. in project settings > physics your layers don't collide with each other
How are you moving the object? With transform.position (this breaks physics) or using physics?
Yes. I am using transform.rotate to move the object and had an idea that this would be the problem. Any ideas on how I can fix this issue.
Answer by tormentoarmagedoom · Apr 03, 2018 at 07:37 AM
Good day.
Does the object have a RigidBody Component?
:D
Bye!
Answer by meat5000 · Apr 03, 2018 at 10:32 PM
Use this to rotate a rigidbody and still have it respond to physics
https://docs.unity3d.com/ScriptReference/Rigidbody.MoveRotation.html
Modifying rotation directly is the same as modifying position. It teleports and misses out essential steps of collision. MoveRotation and MovePosition address this by working out if any collisions occured between movements.
I did this but it still goes right through. I know this is the problem though because if it is stationary, colliders work just fine.
Your answer
Follow this Question
Related Questions
2D Colliders aren't actually touching but they're behaving like they do? 0 Answers
Sprites collision not working on high speeds 1 Answer
Avoid Player bouncing when colliding with objects 3D 1 Answer
Adding boundaries to restrict rigidbody2D movement 1 Answer
How to set collision for an object with specific collider size? 3 Answers