Hi, I’m new to Unity3D.
I have some basic understanding of it, but I cannot figure out which character controller to use. The character in the game would be doing all standard platforming movements, but it would also have some power-ups (speed boost) and interactions with other physics-based objects (grabbing and throwing these objects).
Would rigidbody or Character Controller work best for this?
Also, I am experimenting with rigidbody at the moment. I have this code set up to the sheep plane to move and jump. Also, I have a box collier set to the plane at 1, 1 ,1. I am wondering why when I move the sheep into a cube set with a box collier, it is jittering between the inside and outside of the box (the sheep plane does not have alpha and its imported from blender).
using UnityEngine;
using System.Collections;
public class PlayerMoveScript : MonoBehaviour {
public float jumpSpeed = 0f;
public float movementSpeed = 0f;
public void Update() {
//Is the Player pressing the buttons to move right or left.
Vector3 horMovement = Input.GetAxis ("Horizontal") * transform.right * Time.deltaTime * movementSpeed;
//move the player
transform.Translate(horMovement);
}
public void FixedUpdate () {
/*check if player is on ground, than jump
* Raycast: (starting position, direction to send ray, how long to extend the array) */
if (Input.GetKeyUp("space") && Physics.Raycast (transform.position, -transform.up, 1))
{
rigidbody.AddRelativeForce(transform.up * jumpSpeed, ForceMode.Impulse);
}
}
}