So, i’ve been at the part 3 of the tutorial for the past hour. I can not seem to get the ball to move…
here is the ode i have so far:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}
and here is the error that keeps popping up
NullReferenceException: Object reference not set to an instance of an object
PlayerController.FixedUpdate () (at Assets/scripts/PlayerController.cs:20)
i’ve tried just about everything, i’m using unity 5.0.1f1 personal
pls help…
I start getting errors once I try to add text in lesson 8. The counter is working correctly otherwise.
The referenced script on this Behaviour is missing!
GameObject (named ‘EventSystem’) references runtime script in scene file. Fixing!
Hey guys, I wanted to improve this game a little bit, so I wrote a script which spawns pickUp elements in random places of playground, after that I wanted to create script which spawns holes in random places in the ground, which our player can fall through but I dont have any idea how to remove collider in certain point of the ground. Could you give me some advice? Or any link to tutorial? I’ve tried to find something on my own, but still don’t have anything.
I don’t think you can make holes in the collider. What you can do is make different ground with holes n differents places and swap grounds to make holes “appears”. But I think it’s gonna causes some issues because you will lose you mesh, your ridig body and your collider for a frame. And I don’t think thats good.
Im not a pro because im still working through the tutorials, but i guess you could disable the SphereCollider and after a short delay reenable it. For the wholes you could use Invoke and instantiate something like a black round circle on the floor which looks like a hole. But i dont know how you can make that you can “see through” this wholes and the floor beneath in that spot where you spawned the circle…
With this the player just would fall through the circle, which would like rly unrealistic^^
MAybe if it’s possible to change a material ingame in one frame. For that you would need a dedicated texture. Something with a black circle. Then trigger a materiel change.
Yes but if you rly want the “holes” to appear randomly, you cant just switch to another texture with a hole where you want it to be^^
I googled a bit and it seems to be difficult to generate realtime holes in meshes without knowledge of shaders etc.
You are right guys, it doesn’t seem to be easy task xD I am gonna stick to my idea, maby it looks a little bit unrealistic, but works for now. There are more basic things that I have to learn first
Can anyone tell me why “rb.AddForce(Vector3.zero);” still moves the ball?
It gets velocity over time (i guess something like epsilon), but if you wait long enough the ball starts moving veeeery slow and builds up in speed.
If i remove the rb.AddForce() line, it stays at velocity = 0.