- Home /
How do I make rotating objects collide?
I have been trying to get my character to collide with rotating pieces of a maze. When they don't rotate the collisions work fine, but there is no collision when they are. I have tried different colliders on the player and on the maze, but no matter I can't seem to make any progress...
My code for the rotation is
#pragma strict
var speed = 5;
function Start ()
{
}
function Update ()
{
transform.Rotate(0, speed * 1,0);
}
Answer by TimBorquez · Dec 17, 2013 at 08:43 PM
you can use a joint and just turn the motor for it on,
so like with a hinge joint component on the object you want to spin, you could give the ground a kinematic rigidbody and put it in the connected body part of the hinge component
then turn on "use motor" and give it target speed and force
then you can set an axis to 1 for the axis you want it to spin on
anyways,
if you don't wanna use a joint I'm pretty sure you still have to do the rotating a different way using physics forces