• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=thomasfn;41692575]I guess you should raycast downwards to find the normal of the surface your character is walking on, then when you set the character's velocity, use the normal to calculate the vector going down the hill.[/QUOTE] Implemented this, works beautifully. Got it working without any bugs too. Could I get some feedback on the player controller? [unity]https://dl.dropboxusercontent.com/u/13781308/Unity/Shooter/Build/Build.unity3d[/unity]
[QUOTE=Pelf;41697836]Implemented this, works beautifully. Got it working without any bugs too. Could I get some feedback on the player controller? [unity]https://dl.dropboxusercontent.com/u/13781308/Unity/Shooter/Build/Build.unity3d[/unity][/QUOTE] I don't see why they wouldn't work, I don't recall garry removing them. And yes, it works pretty well going down the hill. Nice job.
Friend's decided to make a scrolling shooter in Unity and I decided to help them, this is the progress so far. Got a little jetpack (with trails that shouldn't be there all the time) jumping, enemies, ect. [video=youtube_share;Y5hJAy6gZwk][URL]http://www.youtube.com/watch?v=Y5hJAy6gZwk&feature=youtu.be[/URL][/video]
[QUOTE=Xystus234;41699569]Friend's decided to make a scrolling shooter in Unity and I decided to help them, this is the progress so far. Got a little jetpack (with trails that shouldn't be there all the time) jumping, enemies, ect. [video=youtube_share;Y5hJAy6gZwk][URL]http://www.youtube.com/watch?v=Y5hJAy6gZwk&feature=youtu.be[/URL][/video][/QUOTE] There seems to be room for improvement. Like why would you use trails for jetpack, it would be much easier and better looking to use particle systems and then control their emission with a script.
If you have a CharacterController (and you most likely should), you can easily check if you're on the ground, and then enable/disable the trail/particle emitter.
Still making progress with The Hills. If you want to play check this link because I don't know how to embed the unity player. :v: [url]http://fridayplay.net/hills/[/url] Edit: Check it. [unity]http://fridayplay.net/hills/0_0_4.unity3d[/unity]
[QUOTE=RattSplat;41720645]Still making progress with The Hills. If you want to play check this link because I don't know how to embed the unity player. :v: [url]http://fridayplay.net/hills/[/url][/QUOTE] [noparse][unity]linkto.unity3d[/unity][/noparse]
[QUOTE=RattSplat;41720645]Still making progress with The Hills. If you want to play check this link because I don't know how to embed the unity player. :v: [url]http://fridayplay.net/hills/[/url] Edit: Check it. [unity]http://fridayplay.net/hills/0_0_4.unity3d[/unity][/QUOTE] Is it just me or do the main menu buttons not do anything when you click on them?
[QUOTE=Pelf;41721224]Is it just me or do the main menu buttons not do anything when you click on them?[/QUOTE] - Only singleplayer works. - Haven't started networking yet - Exit doesn't seem to work - The scaling with the web player is seems to be based on your screen and not the player.. I'll get back to working on it.
[QUOTE=RattSplat;41721260]- Only singleplayer works. - Haven't started networking yet - Exit doesn't seem to work - The scaling with the web player is seems to be based on your screen and not the player.. I'll get back to working on it.[/QUOTE] Clicking the menu buttons literally doesn't do anything for me.
[QUOTE=Chris220;41726102]Clicking the menu buttons literally doesn't do anything for me.[/QUOTE] I see what you mean, it works in the embedded web-player if I click it a lot.. I'll always be uploading the latest builds here: [url]http://builds.fridayplay.net/[/url]
Latest build - 0.0.5 + Added NGUI + Added menu scene terrain & sounds + Added a new singleplayer scene with a few artifacts (the scary stuff) + Added new terrain objects to the sp scene - Fixed the menu not loading other scenes - Fixed the menu scene's cursor - Modified sp scene's fog, moonlight (sun), and ambient light - Modified a few of the artifacts in sp - Removed herobrine By the way, listen to the menu sound for ten hours for maximum PTSD. [unity]http://builds.fridayplay.net/the-hills/0_0_5/0_0_5.unity3d[/unity]
Getting a black screen before the menu loads.
Screenshot of a game I've been working on for a little while now. [t]http://i.imgur.com/0hJ1lTw.jpg[/t]
Im trying to get an isometric camera working, whereby the player can rotate full 360 degrees but the camera always stays in a isometric perspective following the player. To do this I have thought of the following: [IMG]http://i.imgur.com/ucGMxBD.png[/IMG] So the player position game object controls the player and camera position, the player has its own rotation that doesnt affect the camera, and I can achieve very easy camera rotation by rotating the camera target. Does this sound like a reasonable way of doing it? Or would you suggest a more elegant way? And that brings me to another question, If i wish to rotate the camera 90 degrees smoothly, what would be the best aproach? [csharp] public class CameraRotation : MonoBehaviour { public float Angle = 45f; private float rotateOffset = 0; private bool rotationActive = false; void Awake() { transform.rotation = Quaternion.Euler(0, Mathf.RoundToInt(Angle) , 0); } void FixedUpdate () { if(rotationActive) { Angle = Angle + rotateOffset * Time.deltaTime; //Wrap the angle between 0 and 360 if(Angle > 360f) Angle -= 360f; if(Angle < 0f) Angle += 360f; } //By adding 45 it means the camera always has a rotated offset of 45 degrees, ie: it will be 45, 135, 225, 315 if(Mathf.Round(Angle + 45f) % 90 == 0) { rotationActive = false; rotateOffset = 0f; Angle = Mathf.RoundToInt( Angle ); } transform.rotation = Quaternion.Euler(0, Mathf.RoundToInt(Angle) , 0); } void Update() { if(Input.GetKeyDown(KeyCode.Q)) { rotateOffset = 90f; rotationActive = true; } if(Input.GetKeyDown(KeyCode.E)) { rotateOffset = -90f; rotationActive = true; } } } [/csharp] Is what I currently have, however its dangerous because if Angle changes to a value that means Mathf.Round(Angle + 45f) % 90 != 0 then it could rotate for ever
CameraTarget (and its child) doesn't have to be parented to PlayerPosition. You might want to consider creating a CameraFollow script that follows the target instead. With that you could make cutscenes (e.g. player using a lever moves the camera towards the door it opens for a short while) [img]https://dl.dropboxusercontent.com/u/7422512/Unity3D/oneway.PNG[/img] For smoothness: Use Quaternion.RotateTowards. [unity]https://dl.dropboxusercontent.com/u/7422512/Unity3D/test/test.unity3d[/unity] CameraRotate.cs (Put this in CameraTarget) [code] using UnityEngine; using System.Collections; public class CameraRotate : MonoBehaviour { public float speed = 10; private Quaternion to; // Use this for initialization void Start () { transform.rotation = Quaternion.Euler(0, 35.264f, 0); to = transform.rotation; } void OnGUI() { GUI.Label(new Rect(10,10, 250, 30), "Y Rotate Speed: "+speed.ToString()); GUI.Label(new Rect(10,45,50,30), "0"); GUI.Label(new Rect(230,45,50,30), "300"); speed = GUI.HorizontalSlider (new Rect (25, 50, 200, 30), speed, 0, 300); } private int a = 0; // Update is called once per frame void Update () { float step = speed * Time.deltaTime; if(Input.GetKeyDown(KeyCode.Q)) { a++; if(a > 3) a = 0; to = Quaternion.Euler(0, 35.264f+(90*a), 0); } if(Input.GetKeyDown(KeyCode.E)) { a--; if(a < 0) a = 3; to = Quaternion.Euler(0, 35.264f+(90*a), 0); } transform.rotation = Quaternion.RotateTowards(transform.rotation, to, step); } } [/code]
Finally found a Unity UI library that doesn't totally suck dick, and doesn't do things in an ass backwards way. Finally can fuck NGUI the fuck off. [url]http://www.daikonforge.com/dfgui/examples/menu/[/url]
[QUOTE=garry;41825089]Finally found a Unity UI library that doesn't totally suck dick, and doesn't do things in an ass backwards way. Finally can fuck NGUI the fuck off. [url]http://www.daikonforge.com/dfgui/examples/menu/[/url][/QUOTE] Literally thank you so much. I dreaded the fact that I eventually had to get NGUI because it was the only decent one out on the market, but this is so much better.
I really should start getting myself comfortable with Unity if I want to do anything productive these last few weeks of the summer holiday. Can anyone recommend a good up-to-date Unity tutorial series?
[QUOTE=Clavus;41826177]I really should start getting myself comfortable with Unity if I want to do anything productive these last few weeks of the summer holiday. Can anyone recommend a good up-to-date Unity tutorial series?[/QUOTE] I like [url]http://unitygems.com/[/url] and just generally trying out things and googling what you want to do. And you can always ask Unity related questions here.
[QUOTE=Clavus;41826177]I really should start getting myself comfortable with Unity if I want to do anything productive these last few weeks of the summer holiday. Can anyone recommend a good up-to-date Unity tutorial series?[/QUOTE] Go through the official tutorials first. They will run you through most things you need to do better than most tutorials. They game tutorial they have there is good as well, but there are more varied tutorials on the internet. These are just the best for explaining the basics of unity and the components. [url]http://unity3d.com/learn/tutorials/modules[/url]
I would like to learn Unity aswell but Unitygems seems little weird for me. Any other good sites?
[QUOTE=garry;41825089]Finally found a Unity UI library that doesn't totally suck dick, and doesn't do things in an ass backwards way. Finally can fuck NGUI the fuck off. [url]http://www.daikonforge.com/dfgui/examples/menu/[/url][/QUOTE] I wrote an entire wrapper library for NGUI to programatically creating UI with ease. I hate how most of these Unity UI tools are designed for creating it in the editor and not through code.
[QUOTE=Conna;41827209]I wrote an entire wrapper library for NGUI to programatically creating UI with ease. I hate how most of these Unity UI tools are designed for creating it in the editor and not through code.[/QUOTE] I love that. 90% of the time if you're actually writing code in Unity you're doing it wrong.
[QUOTE=Krizzu;41827037]I would like to learn Unity aswell but Unitygems seems little weird for me. Any other good sites?[/QUOTE] [url]http://unity3d.com/learn/tutorials/modules[/url]
I've been playing around with Unity a lot after reading this thread, I'm a rather shitty programmer but I'm finding C# easy enough to work with. I've just been following some tutorials and stuff for now and I'm finding it rather fun, I've always wanted to make a game myself but I've really only made little mods or maps of other games so this is a good learning experience. [QUOTE=Richy19;41814237]Im trying to get an isometric camera working, whereby the player can rotate full 360 degrees but the camera always stays in a isometric perspective following the player. To do this I have thought of the following: [IMG]http://i.imgur.com/ucGMxBD.png[/IMG] So the player position game object controls the player and camera position, the player has its own rotation that doesnt affect the camera, and I can achieve very easy camera rotation by rotating the camera target. Does this sound like a reasonable way of doing it? Or would you suggest a more elegant way? And that brings me to another question, If i wish to rotate the camera 90 degrees smoothly, what would be the best aproach? [csharp] ...... [/csharp] Is what I currently have, however its dangerous because if Angle changes to a value that means Mathf.Round(Angle + 45f) % 90 != 0 then it could rotate for ever[/QUOTE] I'm probably a bit late but whatever. I was trying to make an RTS styled game before with a similar camera. As I said I'm rather bad at programming but after following some tutorials and fiddling around with the code, I got a mouse controlled camera that can move and rotate around a point in a somewhat crappy, glitchy way. (Press ctrl + rmb to rotate, scroll to zoom in/out, and move the mouse to the sides to move the camera) [unity]https://dl.dropboxusercontent.com/u/64863030/TestRun.unity3d[/unity] This is what the camera has: [csharp] using UnityEngine; using System.Collections; // The in-game camera controls public class CameraGame : MonoBehaviour { // Zoom stuff public float ZoomLevel = 6; public float ZoomMax = 11; public float ZoomMin = 2; public float MinCameraHeight = 10; public float MaxCameraHeight = 40; public float ZoomSpeed = 5.5f; // LateUpdate is called after every frame void LateUpdate () { CameraZoom(); } // Zooming in and out with the mouse wheel private void CameraZoom () { // Zoom in if(Input.GetAxis("Mouse ScrollWheel") < 0 && ZoomLevel <= ZoomMax) { ZoomLevel += ZoomSpeed; } // Zoom out else if(Input.GetAxis("Mouse ScrollWheel") > 0 && ZoomLevel >= ZoomMin) { ZoomLevel -= ZoomSpeed; } camera.orthographicSize = ZoomLevel; } } [/csharp] And this is what the target it's parented to has: [csharp] using UnityEngine; using System.Collections; public class CameraFocus : MonoBehaviour { // Movement stuff public float ScrollSpeed = 25; public float ScrollWidth = 15; void LateUpdate () { CameraMove(); CameraRotate(); } // Detecting mouse movement private void CameraMove () { float xpos = Input.mousePosition.x; float ypos = Input.mousePosition.y; Vector3 movement = new Vector3(0,0,0); // As long as the left mouse button & ctrl is not pressed if((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) == false) { // Horizontal camera movement if(xpos >= 0 && xpos < ScrollWidth || Input.GetKey(KeyCode.D)) { movement.x -= ScrollSpeed; } else if(xpos <= Screen.width && xpos > Screen.width - ScrollWidth || Input.GetKey(KeyCode.A)) { movement.x += ScrollSpeed; } // Vertical camera movement if(ypos >= 0 && ypos < ScrollWidth || Input.GetKey(KeyCode.S)) { movement.z -= ScrollSpeed; } else if(ypos <= Screen.height && ypos > Screen.height - ScrollWidth || Input.GetKey(KeyCode.W)) { movement.z += ScrollSpeed; } } // Camera movment and locking y axis movement = transform.TransformDirection(movement); movement.y = 0; // Calculate cameraFocus position based on received input Vector3 origin = transform.position; Vector3 destination = origin; destination.x += movement.x; destination.y += movement.y; destination.z += movement.z; // If a change in position is detected, preform the necessary update if(destination != origin) { transform.position = Vector3.MoveTowards(origin, destination, Time.deltaTime * ScrollSpeed); } } // Rotate stuff public float RotateAmountx = 0.0f; public float RotateSpeed = 2000; public float RotateWidth = 10000; private void CameraRotate () { // Getting mouse position float xpos = Input.mousePosition.x; if((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetMouseButton(1)) { RotateAmountx = xpos; } transform.rotation = Quaternion.Euler (0, RotateAmountx, 0); } } [/csharp] I don't know if this code is any good or not, but I can say that the problem with my method is that the rotation will "jump" to the point you click at. But I'm sure there is an easy way to fix to that.
I hate having to edit GUIs in the editor. I feel like I have more control and it's cleaner when it is in code.
[QUOTE=Duskling;41833957]I hate having to edit GUIs in the editor. I feel like I have more control and it's cleaner when it is in code.[/QUOTE] I have never used GUIs in Unity yet, but I hate coding GUIs for anything else, they're so much easier to make visually.
If I want to get into developing little minigames with unity, where do I start? I thought asking here was a good idea since out there on the internet, there are out dated stuff. Also, I plan on developing with javascript since I dont know c#
Start by making simple games. I think I posted this [url=http://forum.unity3d.com/threads/26785-Unity-Jump-Start-Video-Tutorials]link[/url] twice in this thread (not including this post). It guides you to implement the core mechanics (movement, dumb AI, shooting, collision, score, game states) of Space Invader in Unity, and teaches you the basic flow on using Unity. The tutorial is in Javascript. What you really want from the tutorial is to learn the workflow of Unity, anyway. What it teaches you: [unity]https://dl.dropboxusercontent.com/u/7422512/Unity3D/basic/WebPlayer/WebPlayer.unity3d[/unity] Minor changes/improvement in several minutes of edit: [unity]https://dl.dropboxusercontent.com/u/7422512/Unity3D/basic2/WebPlayer/WebPlayer.unity3d[/unity]
Sorry, you need to Log In to post a reply to this thread.