Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

adding a force to a dice and find out which face collided with the ground

$
0
0
I'm having trouble adding strength to a dice and make him go forward and then after a certain time. And also like to know what was the face that is glued to the floor in order to then pin down the value of the dice. Sorry for the question. Because I am a beginner in programming. Sorry for my bad English. using UnityEngine; using System.Collections; public class Dice1Script : MonoBehaviour { public CubePlayerScript cubePlayerScript; public float forceMove = 5.0f; public GameObject face1; public GameObject face2; public GameObject face3; public GameObject face4; public GameObject face5; public GameObject face6; // Update is called once per frame void Update () { if (cubePlayerScript.launchedDice) { rigidbody.AddForce(forceMove * Time.deltaTime, 0, 0); } if (rigidbody.velocity == Vector3.zero) { if(Physics.Linecast(transform.position, face1.transform.position)){ Debug.Log("The dice value is 6"); } } } }

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>