- Home /
Roll-A-Ball Problem
Hi guys, I know I sounds super stupid for having issues with the easiest tutorial there is, but I'm a 12-year-old newbie who wants to learn to develop, so don't judge! Anyways, I'm on part four of the tutorial, Roll-a-ball, and I've just wrote the script it told me to write, seemingly perfect (I've checked, I can't spot errors), but my ball has suddenly bounced up into space, and then it falls down and bounces again. I'm baffled as to how a script affecting the camera can have this affect, but then again... the player object is mentioned in it. Like I said, I sound dumb, but please help! I'd love to be able to develop games when I'm older, and starting young seems like a good idea.
Either post the code you added so we can find the problem or post this in the forums so you can get extended help. (although it seems like you are just applying the force on the ball in the wrong direction).
I just posted the code above if that helps anybody :)
using UnityEngine;
using System.Collections;
public class CameraController : $$anonymous$$onoBehaviour
{
public GameObject player;
private Vector3 offset;
// Use this for initialization
void Start ()
{
offset = transform.position - player.transform.position;
}
// Update is called once per frame
void LateUpdate ()
{
transform.position = player.transform.position + offset;
}
}
this script works but it doesn't allow the ball to move around the screen, the errors i was before hand are gone but now no movement is eligible
Answer by Corefinder · Mar 25, 2015 at 11:37 PM
Try raising the ball higher in the air, I had a similar issue and it fixed it. Happy learning!
Answer by Darkyrue · Jan 16, 2016 at 04:27 PM
i am having a similar problem. i tried following the Script on the tutorial and it wouldn't let me open the game to mplay anmd make the the ball go move, move with wasd or the arrow keys or any other defualt buttomns used within other games to move objects and sprites around lol.... im tired and hate this lol....
If you are struggling with even getting play mode to open, then check your Console (the tab on the bottom left next to Project). That's where error messages, specifically those related to your code, are going to be. It could be that you never linked an object to a public variable, or you mixed up a few symbols, or you dropped a semi-colon or a bracket. What I found working through this tutorial was that any time everything seemed broken, I had missed a fairly small thing, and 3/4 of the time it was listed in the Console.
Good luck!
Your answer
Follow this Question
Related Questions
roll-a-boll tutorial-rotator error 1 Answer
Rolling ball on many boxes causes bounce 0 Answers
How to code in coins 1 Answer
How to predict where the ball will land after being hit by bat? 4 Answers