Character stand straight
I've implemented a spell casting system where my character always faces where he is casting. This some times makes his y rotation change when he's casting upwards (flying enemy etc). I would like to...
View ArticleIs character facing in the direction of camera?
How could I check if the character is facing in the direction of the camera or away from it?
View ArticleControllerColliderHit, two objects, takes wrong one
I'm using this code to detect the collision between my player and "Cloud" gameObject. Funnily enough this code: function OnControllerColliderHit(hit : ControllerColliderHit) { if...
View ArticleHow to get NetworkViewID and GameObject attached to NetworkViewID
I can't seem to find reliable information about this. I have a Network View component attached to a game object. How can I access this Game Objects NetworkViewID from code? I have tried...
View ArticleDrawing a box with mouse dragged on screen
When a user clicks mouse0 I set a Vector2 orgBoxPos = Input.mousePosition; While he is holding down mouse0, I constantly update Vector2 endBoxPos = Input.mousePosition; I then try this to draw this box...
View ArticleIf button held 3 seconds do something
I'm trying to do a Crouch/Lay down system: 1) Press C => crouch 2) Hold C for 3 seconds => lay down The logical way to do this seemed to be to use a timer: if (Input.GetButtonDown ("Crouch")) {...
View ArticleCharacter Controller/Motor Ground Delta
Is there a way to set a distance between the Character Controller/Motor and the ground? My ground is quite wobbly and I would like to avoid shaking the character and the camera by having the character...
View ArticleVoxel Lighting
I'm working on a Voxel project for fun and learning. I've been reading up a lot on how this is done and have implemented a simple Voxel map in my project. My question is about the lighting. I've read...
View ArticleUV Map, change texture color (lighter/darker)
I'm trying to figure out how I could make my own lighting system for my UV map in Unity. I have the theory nailed down (I believe) but I'm having problems on the practical side. I have a voxel...
View ArticleSelf-Illum Diffuse, how does it work?
I'm trying to use the built in self-illum diffuse shader. I have put a Base and an Illum texture on the object. The Illum is all black for testing purposes (also tried different shades). The Illum...
View ArticleShader that uses UV1 to map texture and UV2 to map light
I'm using a texture atlas and a light atlas to tile a mesh. I have the texture atlas working fine. I can apply textures and create a sort of tile map on my coded mesh. At the moment I'm using the...
View ArticleGetting all scripts attached to a gameObject (Problem)
GameObject go = GameObject.Instantiate(bullet, transform.position, Quaternion.identity) as GameObject; Component[] c = go.GetComponents(MonoBehaviour); foreach (MonoBehaviour script in c) {...
View ArticleMaking a jump with Rigidbody2D character
I'm trying out the newish Unity 2D features. I'm trying to make a basic platformer. I've got left/right movement working with AddForce but I'm getting stuck on the jump. Here's what I have: if...
View ArticleSimple Rigidbody2D controller (Platformer Jump)
I'm trying to make a very simple character controller script for an object with a rigidbody2D (aiming for basic 2D platformer gamelay with WASD and Space to jump). void HandleMovement() { if...
View ArticleBest way to make a tilemap with the 2D features
I'm wondering what is the best way to make a tilemap with the 2D features. (Tilemap for a platformer like an old mario, not top-down like an old rpg, if that changes anything). What I've thought of so...
View ArticleGetting a smooth jump with the Character Controller
I'm embarrassed to post this here, as there are already several instances of this question on the boards but sadly no proper answers. This is the Update method of my PlayerControl script: void Update()...
View Article