So I’ve been working on the survival shooter tutorial they’ve got up on the learn section of the site.
It’s been going well, everything works… but it seems like the ray cast has some accuracy problems when I’m trying to hit the capsule collider from certain angles. It always registers a hit when I aim toward the base of the enemy. But, if I aim for the head it only registers a hit from certain angles. Additionally, the effect that shows up on the enemy where it was hit doesn’t appear on the top/head of the enemy, even when that area is hit (unless he’s bent about to die, ha ha). The capsule collider is set up exactly as specified in the tutorial. I even tried adding a huge one over the head just to see what would happen, and it still has similar issues.
Shooting next to the enemy like this is where it’s not registering hits to the head/upper part of the enemy at all. It still hits when I aim lower on the enemy, but if I aim for the head, the beam flies right behind the head and registers the hit somewhere in the distance, like the train or car or whatever’s there. He’s falling over to die in this picture…
Shooting up or down to the enemy as in the following picture works ok. It hits when I aim at the head, but the effect still doesn’t show up over the head. I shot up on the top of his head for this picture:
Am I missing something really obvious here… or is this normal? Some issue with how we’re seeing what’s really happening through the camera? It makes game play pretty frustrating if you’re aiming at the top of the bunny and it doesn’t register the hit. :\ Is there a solution for this? I’m a unity newbie, so please excuse me if this is painfully obvious to you more experienced people.
Thanks for your advice!
EDIT: I think I get why this works this way. As I understand, the ray is being cast out forward from the tip of the gun. The camera has a different viewpoint and it might look like it should hit from this point of view, but not from where it’s actually being cast. Hmmm…
Thanks for your post on Survival Shooter. For simplicity we have indeed taken the approach that the ray shoots forward from the gun parallel to the floor. We did this so as to keep things simple for the training day (the original use of this project) and so that it’s not too much complexity for the beginner.
To add the functionality you have it makes sense to add an else to the point at which we shoot the ray and draw the line, instead of simply using the point on the collider, you could use the ray drawn from the camera to find the point on the collider - or under the mouse position. so basically it would allow you to aim up.
Anyone up for writing an example of this for Lana? there’s a challenge! I would but am super busy right now hoping someone here can dive in and show you what I mean - or maybe you already can do it yourself! either way have fun
I am having a different issue with this tutorial. Since it is in the same program I thought I would just put the question in here. I have completed the tutorial and everything runs like it is supposed to in Unity. When I build and run the game as a web player or as an .exe, I do not ever see the “Score” GUI or the “Game Over” animation GUI. Is there some type of compatibility editing to those pieces of the HUD that I need to perform to make it work outside of Unity?
tgraef: You should check your anchors in your anchors and presets menu.
I would suggest you have the score anchored to the top of the canvas.
There are both documentation pages and at least one live session on resolution independence, which might help. It’s clear your aspect ratio changes between your editor view and your deployed game.
On thing that might help would be to create an aspect ratio / resolution preset in the game view and test that in the editor.
I sorted the problem out! When you press “Build”, make sure you delete the scenes in build that appear there and then press the button “Add Current”. Only after that press “Build” and voila!
Yes, the build settings window will build only the scenes you have added to it - with one exception (iirc…). If my memory serves, only if you have NO scenes in the build settings window at all, and try to build, Unity will use the current scene, otherwise it will only use the scenes in the build window (which makes sense - as it’s only building the scenes you are asking it to!). If you don’t have your current build in the build settings window, it won’t be built!
At the end of the tutorial (unity 5) the game does restart but it never shows the “game over” part. There are two reload or restart games in the code. One is on the GameOverManager script and the other is on the PlayerHealth script. Science the animation isn’t running, I have to assume that its still using the player health restart. I tried removing / commenting it out and it did not use the game over manager restart.
Also, I have the issue where the screen gets darker every time it restarts. if you play the game to death and end it, then the game window goes completely black except you and the zombunny. to get it back you have to disable and re-enable the environment component. but how do we fix this so that when people are playing it, it just works.
@AK123@neoedgar I’m unable to say for sure but this could potentially be a problem with Unity rather than the project. There is a screen fader gameobject which is part of the UI. It could be a problem with the code controlling that. To determine if this is the case, keep an eye on the alpha level of the screen fader’s image. If it is consistently getting higher then the problem is in the code controlling it, I’ll take a look at it and hopefully fix it. If the alpha level is staying consistent then it could be a problem with Unity and we’d really appreciate you sending us a bug report.
I’m closing this thread, as the OP has been answered.
Can you please read the FAQ in the OP of the official thread, then browse the thread for additional answers. If at this point your question is still unanswered, please post there.