- Home /
Question by
Skeeters · Oct 10, 2011 at 05:58 PM ·
controllerjumpballwithout
I WANT TO MAKE MY BALL JUMP :(
ALL I GOT IS THIS :
using UnityEngine;
using System.Collections;
public class MarbleControl : MonoBehaviour {
public float movementSpeed = 6.0f;
void Update () {
Vector3 movement = (Input.GetAxis("Horizontal") * -Vector3.left * movementSpeed) + (Input.GetAxis("Vertical") * Vector3.forward *movementSpeed);
rigidbody.AddForce(movement, ForceMode.Force);
}
void OnTriggerEnter (Collider other ) {
if (other.tag == "Pickup")
{
MarbleGameManager.SP.FoundGem();
Destroy(other.gameObject);
}
else
{
//Other collider.. See other.tag and other.name
}
}
}
Comment
Answer by FLASHDENMARK · Oct 10, 2011 at 06:11 PM
Just use Rigidbody.AddForce when the space bar is pressed to propel the rigidbody upwards.
Your answer
Follow this Question
Related Questions
Smoothing out jumping? 1 Answer
I also used to check is grounded raycast and OnCollisionEnter2D but still there was such a problem. 0 Answers
MMD How to export model and animations to Unity as 3rd person controller? 2 Answers
Player appears to teleport instead of adding force 2 Answers
Controlled sphere/ Ball game 2 Answers