- Home /
Question by
molooco · Dec 12, 2016 at 07:50 AM ·
cubeissuespherecollision issues
While my cube is moving my RollerBall doesn't collide with the cube and falls, but when is not moving it colides and doesn't fall.
How can i solve my collision problem. i would like my RollerBall not to fall although the cube is moving. Here is my rotating script (C#)
using UnityEngine;
using System.Collections;
public class rotate : MonoBehaviour {
public float myRotationSpeed = 100.0f;
public bool isRotateX = false;
public bool isRotateY = false;
public bool isRotateZ = false;
// CHANGE TO ROTATE IN OPPOSITE DIRECTION
private bool positiveRotation = false;
private int posOrNeg = 1;
// Use this for initialization
void Start ()
{
GetComponent<Collider>().isTrigger = true;
if(positiveRotation == false)
{
posOrNeg = -1;
}
}
// Update is called once per frame
void FixedUpdate ()
{
// Toggles X Rotation
if(isRotateX)
{
transform.Rotate(myRotationSpeed * Time.deltaTime * posOrNeg, 0, 0);//rotates coin on X axis
//Debug.Log("You are rotating on the X axis");
}
// Toggles Y Rotation
if(isRotateY)
{
transform.Rotate(0, myRotationSpeed * Time.deltaTime * posOrNeg, 0);//rotates coin on Y axis
//Debug.Log("You are rotating on the Y axis");
}
// Toggles Z Rotation
if(isRotateZ)
{
transform.Rotate(0, 0, myRotationSpeed * Time.deltaTime * posOrNeg);//rotates coin on Z axis
//Debug.Log("You are rotating on the Z axis");
}
}
}
Comment
Your answer
Follow this Question
Related Questions
having over 100.000 cubes in one scene 0 Answers
Adjusting strange Vector3.Normalize behaviour 2 Answers
How to make my rotating sphere sticky? 2 Answers
Spheres multi render with mapcubes 1 Answer
Reverse Spherifying A Cube 1 Answer