• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=Over-Run;45020024]Yeah I started messing about with the line renderer but it seems to not rotate correctly or start at the right position for some reason :S[/QUOTE] You can set the linerenderer to use world space or local space, should be somewhere on the inspector.
I see. Still having issues getting it to work right. I have a SpellEmitter game object that I use to shoot spells from and it works fine for shooting out fireballs and shit but with the line renderer it looks like the line appears to the left of it. I'm not sure if I'm doing it right In the update where I want it to follow the object that is picked up I have [code] lr.SetPosition(0, SpellEmitter.transform.position); lr.SetPosition(1, SpellEmitter.transform.position + SpellEmitter.transform.forward * HOLD_DISTANCE);[/code] So from the SpellEmitter to the object. But yeah not working right
Is it possible to modify the transform of the scene view camera in the editor? Trying to make buildings and stuff on a sphere is a pain when the camera is sideways relative to the surface.
[QUOTE=Pelf;45020810]Is it possible to modify the transform of the scene view camera in the editor? Trying to make buildings and stuff on a sphere is a pain when the camera is sideways relative to the surface.[/QUOTE] I haven't tried adjusting the rotation of the scene view camera before, but you can get the camera by using [code] SceneView.lastActiveSceneView.camera [/code] You will have to make a custom editor script in order to get it working though. Also, at the request of somebody earlier in the week, I put together some basic hotkeys for the Animation window. So you can play/pause/stop and advance through keyframes using keypresses as well as the buttons. [url=https://github.com/JamesWilko/UnityAnimationHotkeyExtension]https://github.com/JamesWilko/UnityAnimationHotkeyExtension[/url]
Sunset on an asteroid [vid]https://dl.dropboxusercontent.com/u/13781308/Videos/Asteroid%20Sunset.mp4[/vid] The system is a bit crude at the moment, and windows movie maker trashed the quality. And stupid youtube flagging the music. why do I bother [editline]edit[/editline] Dropbox'd it, at least the music can stay now
[QUOTE=Over-Run;45020209]I see. Still having issues getting it to work right. I have a SpellEmitter game object that I use to shoot spells from and it works fine for shooting out fireballs and shit but with the line renderer it looks like the line appears to the left of it. I'm not sure if I'm doing it right In the update where I want it to follow the object that is picked up I have [code] lr.SetPosition(0, SpellEmitter.transform.position); lr.SetPosition(1, SpellEmitter.transform.position + SpellEmitter.transform.forward * HOLD_DISTANCE);[/code] So from the SpellEmitter to the object. But yeah not working right[/QUOTE] Maybe the pivot point of the SpellEmitter is not where it should be? But then the fireball should come from that spot too.
[img]http://i.imgur.com/R2yXCZy.gif[/img] [img]http://i.imgur.com/HBvBls6.png[/img] Made that extension for rotating the scene view. Unfortunately it doesn't auto update the rotation, so you have to right click the scene to get it to update the camera. It also doesn't work in orthographic mode. If anybody knows how to get the scene view camera to update itself it'd be awesome if you could share. SceneView.Repaint() and RepaintAll() don't work, and camera.Render() doesn't work either unfortunately. Its on GitHub here: [url]https://github.com/JamesWilko/SceneViewRotation[/url]
[QUOTE=NinjaWilko;45024034] [IMG]http://i.imgur.com/HBvBls6.png[/IMG] Made that extension for rotating the scene view. Unfortunately it doesn't auto update the rotation, so you have to right click the scene to get it to update the camera. It also doesn't work in orthographic mode. If anybody knows how to get the scene view camera to update itself it'd be awesome if you could share. SceneView.Repaint() and RepaintAll() don't work, and camera.Render() doesn't work either unfortunately. Its on GitHub here: [URL]https://github.com/JamesWilko/SceneViewRotation[/URL][/QUOTE] That's incredible, thanks. That'll make placing stuff on my asteroid sooo much easier
Is there a simple editor extension similar to GameDraw ? Because GameDraw is being pretty buggy for me, for example I can't move the vertices and all that.
There's ProBuilder.
[QUOTE=NinjaWilko;45024034]Made that extension for rotating the scene view. Unfortunately it doesn't auto update the rotation, so you have to right click the scene to get it to update the camera. It also doesn't work in orthographic mode. If anybody knows how to get the scene view camera to update itself it'd be awesome if you could share. SceneView.Repaint() and RepaintAll() don't work, and camera.Render() doesn't work either unfortunately. Its on GitHub here: [url]https://github.com/JamesWilko/SceneViewRotation[/url][/QUOTE] This uses crazy CPU on my laptop for some reason.
I've tried not to ask for more help, but I'm pretty screwed here. I seriously have no idea what is happening. Let me explain the problem. I'm currently using Photon networking for Unity. I'm making a top-down shooter styled game. As a deathmatch, with AI thrown in. The problem is, when a player shoots another player. The players receiving the bullets, get this error when its network destroyed. [CODE]Can't execute received Destroy request for view ID=2127 as GO can't be found. From player/actorNr: 2 GO to destroy= originating Player=Guest4721 UnityEngine.Debug:LogError(Object) NetworkingPeer:OnEvent(EventData) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1707) ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[]) ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:76)[/CODE] The error varies a bit, as the first view ID is a bullet, the 2nd is the player receiving. I've managed to find out that the error is coming from my projectile script. Here's my projectile code. [CODE]using UnityEngine; using System.Collections; public class ProjectileScript : Photon.MonoBehaviour { public int damage; public GameObject bloodObj; public float bloodSpeed; public AudioClip[] sounds; void OnCollisionEnter(Collision other) { if(photonView.isMine) { if(other.gameObject.tag == "Player" || other.gameObject.tag == "NPC") { other.gameObject.GetComponent<PhotonView>().RPC ("TakeDamage", PhotonTargets.All, damage); photonView.RPC ("Bleed", PhotonTargets.All, null); PhotonNetwork.Destroy(gameObject); } else { PhotonNetwork.Destroy(gameObject); } } } [RPC] void Bleed () { var randomX = Random.Range (-360, 360); var randomY = Random.Range (-360, 360); var randomZ = Random.Range (-360, 360); var randomDir = new Vector3 (randomX, randomY, randomZ); GameObject blood = Instantiate(bloodObj, transform.position, Quaternion.identity) as GameObject; blood = Instantiate(bloodObj, transform.position, Quaternion.identity) as GameObject; blood = Instantiate(bloodObj, transform.position, Quaternion.identity) as GameObject; blood.rigidbody.velocity = randomDir * bloodSpeed * Time.deltaTime; blood.audio.clip = sounds[Random.Range(0,sounds.Length)]; blood.audio.Play(); } } [/CODE] Now, with this code alone. [CODE]if(photonView.isMine) { if(other.gameObject.tag == "Player" || other.gameObject.tag == "NPC") { other.gameObject.GetComponent<PhotonView>().RPC ("TakeDamage", PhotonTargets.All, damage); photonView.RPC ("Bleed", PhotonTargets.All, null); PhotonNetwork.Destroy(gameObject); }[/CODE] It works fine, but the bullets bounce off walls, and unless they collide with a player, or NPC. They don't get destroyed. But with this added. [CODE]else { PhotonNetwork.Destroy(gameObject); }[/CODE] Shit gets messed up, and I get that error. At random, whenever the bullet is destroyed. It seems to still send the damage, and what not to the hit object, but the clients receiving, get the error. I sorta know what's happening, but not really. If anyone can help me with this, that'd be awesome, as I've already lost some hair over this..
[QUOTE=Pelf;45025761]This uses crazy CPU on my laptop for some reason.[/QUOTE] Comment out line 103 in SceneViewRotation.cs [code]sceneView.Repaint();[/code] That should help, at the moment its redrawing the sceneview constantly because of that. I accidentally left it in trying to get the camera to auto-update. I'll remove it properly when I can figure out how to fix the auto-update stuff.
I need a lot of help with my Physics spell. I have my demo Monday and I am having a lot of issues with it. Code is here: [url]http://pastebin.com/05CKRE8P[/url] Basically my main issues are: 1) I have a hold distance where the object is held at. Problem is that if the object is picked up very close to the player, the item just goes through walls and stuff to go to the hold distance. I want it to just pick up at the point its at and not do any of the Lerp stuff. 2) The Lerp is broken now, it worked fine before I tried to get it to pick up closeby objects without a Lerp. I think it is because it is in an If statement. 3) Some sort of issue with picking things up. Sometimes they pick up and get released straight away, other times it gets picked up and can't be released, and I have no clue why? Any body have any ideas how I can have it pick up close objects without using the lerp and then use the lerp for far away by looking at my code??
Detail Textures [IMG]http://www.facepunch.com/fp/ratings/heart.png[/IMG] [IMG]https://dl.dropboxusercontent.com/u/13781308/ShareX/2014-06/detail.gif[/IMG] [img]https://dl.dropboxusercontent.com/u/13781308/ShareX/2014-06/detail2.gif[/img]
Nevermind I'm a dumbo. EDIT I have this bit of code [code]Rigid.MovePosition((SpellEmitter.transform.position + SpellEmitter.transform.forward));[/code] And I want it to move the object I have picked up. This bit is being used for when I am close to the object I just want the object to pick up from where it is, so if I press the button the object wont move to the player or anything, it just stays where it is and moves when the player moves. Right now it is sort of popping close the players weapon, which isn't what I want. Any ideas how I can get it to have the desired effect? EDIT EDIT Nevermind I'm a bigger dumbo just added a Lerp fuck I'm so thick
Before I go any farther with my project, I built an in-game puzzle editor in my game so that players could make their own puzzles. What would I need in order to make it so that players can upload their puzzles to a place that other players could download and play them? Would I have to buy some sort of server space or something so that I have somewhere to put the data? I'm don't plan on implementing something like that until it's nearer to release, but I just want to know if it a feasible thing to do. As I've said in a previous post, it's an android game, if that makes a difference.
Quick question: How should I proceed if I want to add Photon Multiplayer to my game, but also want to distribute a Dedicated server software? Is it possible to create a dedicated server for free with photon? If so, how?
[QUOTE=cam64DD;45032391]Quick question: How should I proceed if I want to add Photon Multiplayer to my game, but also want to distribute a Dedicated server software? Is it possible to create a dedicated server for free with photon? If so, how?[/QUOTE] You're going to find it difficult. If you're talking about PUN, it's impossible. If you're talking about Photon Server, you have to essentially write your game logic from scratch inside Photon Server (since you can't really easily port your Unity logic over). You could give TNet a try as a cheap option, or uLink a try as a very expensive (but very solid and fully featured) option.
Working on an online Go app. I've done mostly backend so far and am starting on the front end using Daikon Forge. Does anyone know how to keep a sprites aspect ratio in daikon forge? As you can see it's not great and this wont scale. [URL]http://dl.dropboxusercontent.com/u/41313766/swipe/2014-06-09_00-57-13.mp4[/URL] Can you embed mp4?
[QUOTE=reevezy67;45033990]Working on an online Go app. I've done mostly backend so far and am starting on the front end using Daikon Forge. Does anyone know how to keep a sprites aspect ratio in daikon forge?[/QUOTE] You could write a script to scale the sprite to fit the desired area. - If sprite width is larger, scale sprite width and set height to width multiplied by desired aspect ratio (height/width) - If sprite height is larger, scale sprite height and set width to height multiplied by desired aspect ratio (width/height) I've taken a similar approach before for scaling things like sniper scopes (since you don't want the image to get stretched or squashed, otherwise it looks very unprofessional and amateurish)
It should be built in to DF should it not?
[QUOTE=reevezy67;45034056]It should be built in to DF should it not?[/QUOTE] It could be, although it's easy enough to write yourself. I can bring it up with Takuan for potential integration into 2.0 (maybe an option such that assigning width or height will also set the other in order to maintain aspect ratio). As far as I can tell, it's not a terribly common feature for Unity UI plugins. NGUI didn't have them, at least back when I was still using it (2.x I think? seems to have changed drastically since then, so I could be wrong). Doesn't look like uGUI has them either, oddly enough, but perhaps I'm mistaken since I haven't actually got my hands on it yet.
So I'm trying to make it so my 3D text can be hidden behind surfaces and also effected by light. The hiding behind surfaces works fine but when I set lighting to on it says it needs Normals. How could I fix this? [code]Shader "GUI/3D Text Shader" { Properties { _MainTex ("Font Texture", 2D) = "white"{} _Color ("Text Color", Color) = (1,1,1,1) } SubShader { Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } Lighting Off Cull Off ZWrite Off Fog {Mode Off} Blend SrcAlpha OneMinusSrcAlpha Pass{ Color [_Color] SetTexture [_MainTex] { combine primary, texture * primary } } } }[/code]
[QUOTE=Jacen;45031664]Before I go any farther with my project, I built an in-game puzzle editor in my game so that players could make their own puzzles. What would I need in order to make it so that players can upload their puzzles to a place that other players could download and play them? Would I have to buy some sort of server space or something so that I have somewhere to put the data? I'm don't plan on implementing something like that until it's nearer to release, but I just want to know if it a feasible thing to do. As I've said in a previous post, it's an android game, if that makes a difference.[/QUOTE] Short answer: Yes, it's feasible. Bits you need: -Import/Export of the levels --text/binary/whatever is completely up to you, but: you probably want some sort of checksum, if you're sending "text" through HTTP requests you probably want to base64 it -A public facing server with some storage and the ability to run your own code --Could be a normal webhost, could be a VPS, could be google app engine / amazon thingo / heroku. Your language preference and/or budget will probably be the biggest factors in choosing something here. GAE is free to a point. -Code on the server to handle requests for upload/download of the levels and the list of available levels --Need to handle various requests like - "I want this level." (download level), "What levels are there?" (get list of levels), "What levels are there that are actually good?" (sorted list of levels / ranking system), "Here have my level." (upload level), etc.
[QUOTE=KillaMaaki;45033435]You're going to find it difficult. If you're talking about PUN, it's impossible. If you're talking about Photon Server, you have to essentially write your game logic from scratch inside Photon Server (since you can't really easily port your Unity logic over). You could give TNet a try as a cheap option, or uLink a try as a very expensive (but very solid and fully featured) option.[/QUOTE] Hrm. Say, is Unity's default networking solution really that bad? Also, if I were to make a server mode for my game, where the host doesn't get to actually see any of the game, kinda like a no-graphics mode, would it be any better performance-wise for the whole server?
[QUOTE=cam64DD;45034616]Hrm. Say, is Unity's default networking solution really that bad? Also, if I were to make a server mode for my game, where the host doesn't get to actually see any of the game, kinda like a no-graphics mode, would it be any better performance-wise for the whole server?[/QUOTE] Yes, it's really that bad. It's also buggy as hell. It wouldn't necessarily improve performance (especially if it's still running on the same machine the host is playing on), but the benefit of doing so is that the host then has the option of purchasing a VPS or some similar solution and hosting the server there (which would basically let the host run a public server, which they couldn't necessarily do hosting on their own computer)
[QUOTE=KillaMaaki;45034645]Yes, it's really that bad. It's also buggy as hell. It wouldn't necessarily improve performance (especially if it's still running on the same machine the host is playing on), but the benefit of doing so is that the host then has the option of purchasing a VPS or some similar solution and hosting the server there (which would basically let the host run a public server, which they couldn't necessarily do hosting on their own computer)[/QUOTE] I see. Now, I know I might be asking way too many questions, but what do you guys think of TNet? I'm working on a FPS, and I need a network solution that can handle the job. I want to give the internet the chance to host their own servers.
Hello! One problem I cannot really figure out easily. I need to spawn random points in 3D space ( inside Box collider ) Problem is, I don't know to make random points that are limited, how close they are to each other.. Speed with linked list approach is horrible. N = how many points is there needed; &#945;. Create list L &#946;. Generate random point R &#947;. Check distances with other points in L between R. If distance is smaller than Minimum, go to step &#946; otherwise continue. &#948;. Put point R into list L. &#947;. If N == 0, terminate, otherwise, decrease N by one and continue. Anyone has any idea? It is not for realtime system but inside editor, but still needs to be quite fast.. (think about 500 points in dense space (trees))
TNet is probably fine. You'll need to do some kind of verification (like "who sent this message" to make sure regular clients aren't trying to impersonate the server), and it isn't as fully featured as uLink, but it's a hell of a lot cheaper. That said uLink has a lot of really cool features for the price, like the OnPlayerApproval callback which lets you approve or deny incoming connections (or you can call the Wait method to delay the incoming connection - for instance, in my game the server will call Wait, download the player's inventory, and then Approve the connection, or Deny it if the user doesn't exist or is banned)
Sorry, you need to Log In to post a reply to this thread.