I’m trying to make this happen: Zelda Ocarina of Time Minigame 3 - Bombchu Bowling for Bomb Bag - YouTube
I’ve asked a friend and he’s tried a few different things, but none of them work like what’s in the video.
This is what I currently have:
private Rigidbody r;
public float speed = 5f;
public float angle = 0f;
public Vector3 axis = Vector3.up;
public Transform t;
public GameObject back, top, left, right, bot;
void Start () {
r = GetComponent<Rigidbody> ();
t = transform;
}
void Update () {
}
void OnCollisionEnter (Collision col) {
if (col.gameObject.tag.Equals ("Backwall")) {
float oldAngle = 0.0f;
Vector3 oldAxis = new Vector3();
transform.rotation.ToAngleAxis(out oldAngle, out oldAxis);
transform.rotation = Quaternion.AngleAxis(oldAngle, col.contacts[0].normal) * Quaternion.AngleAxis(90, Vector3.Cross(Vector3.up, col.contacts[0].normal));
}
}
void OnCollisionStay (Collision col) {
if (col.gameObject.tag.Equals ("Botwall")) {
var v = transform.forward * speed;
v.y = r.velocity.y;
r.velocity = v;
}
if (col.gameObject.tag.Equals ("Backwall")) {
var v = transform.forward * speed;
v.y = r.velocity.y;
r.velocity = v;
}
}
Anyone know what I should try doing here?