[QUOTE=BackwardSpy;47112349]I could be miles off here because I don't know how your implementation works; but each time you disable the trail could you not set a flag that tells it the next point will be the start of a new trail?[/QUOTE]
The LineRenderer doesn't expose the functionality necessary to do that. All I have to work with is a single array of positions that the LineRenderer uses to connect the dots. It has no concept of a start or end point. It's all just points. The only reason it looks like a line is ending in the above video is because I've stopped emitting new points, aka, stopped adding new points to the position line. As soon as I start adding them again, the LineRenderer draws a line to the newly added point like it does anywhere else.
The only way I can think of doing this while still using the LineRenderer is to create new GameObjects with a LineRenderer component in them each time a segment starts, and then disconnecct them and shut them off once that segment ends. That's a really hacky way around it so I'm not a big fan of doing that. I guess for my purposes it probably wouldn't have that much of an impact, but it's still a very inelegant solution.
Because of that limitation I'm pretty sure drawing my own meshes is really the way to go. I asked the guy behind Enemy Starfighter about this on Twitter, because I know he had this problem before, and his solution ended up being drawing meshes dynamically. Not the answer I was hoping for, but it's the answer I was expecting.
[QUOTE=war_man333;47112599]I'm thinking I'm doing this in a completely retarded fashion.
I want an animator where every animation can go to every animation.
These transition arrows going everywhere is already complex as hell as is, so what's a good way around this? This is a terrible state machine.
[img]http://i.imgur.com/reosilB.png[/img][/QUOTE]
Is that a... Rube Goldberg state machine? :v:
[QUOTE=Why485;47110490]I'm writing a custom trail renderer because the built in one isn't very robust, and won't let me override the positions of the points on the trails.
Mine is using the LineRenderer because it's pretty close to what I need and I've got something that works pretty well. It allows me to manually move the trail (important for when the origin resets) and I can impart a velocity on the trail elements because that looks cool.
However, it breaks down when you stop emitting trail elements and then start back up again. Due to the nature of the LineRenderer, it'll draw a line between the "end point" of the last segment and the "start point" of the new segment. This is unfortunately, working as intended, as it can't tell the difference between the start and end. It only draws lines between points.
So, I'm at an impasse with this. I don't think the LineRenderer is the way to go, and I'm probably going to have to start drawing and rotating my own quads in order to make a custom trail renderer work the way I'd like it to.
Anybody have any better ideas before I start looking into creating my own meshes on the fly?
-vid-[/QUOTE]
Particles?
[QUOTE=Drury;47112830]Is that a... Rube Goldberg state machine? :v:[/QUOTE]
I think this is better. If there's an even better way of doing this, please say.
[img]http://i.imgur.com/8vthfUe.png[/img]
[QUOTE=Why485;47112816]The LineRenderer doesn't expose the functionality necessary to do that. All I have to work with is a single array of positions that the LineRenderer uses to connect the dots. It has no concept of a start or end point. It's all just points. The only reason it looks like a line is ending in the above video is because I've stopped emitting new points, aka, stopped adding new points to the position line. As soon as I start adding them again, the LineRenderer draws a line to the newly added point like it does anywhere else.
The only way I can think of doing this while still using the LineRenderer is to create new GameObjects with a LineRenderer component in them each time a segment starts, and then disconnecct them and shut them off once that segment ends. That's a really hacky way around it so I'm not a big fan of doing that. I guess for my purposes it probably wouldn't have that much of an impact, but it's still a very inelegant solution.
Because of that limitation I'm pretty sure drawing my own meshes is really the way to go. I asked the guy behind Enemy Starfighter about this on Twitter, because I know he had this problem before, and his solution ended up being drawing meshes dynamically. Not the answer I was hoping for, but it's the answer I was expecting.[/QUOTE]
Fair enough, I see what you mean. I guess a custom trail system is your best bet, then.
[QUOTE=Z_guy;47112685]There's a blue state barely visible in your image called "Any state", doing a transition from that state means that the transition can happen from any state in the state machine.[/QUOTE]
oh my fucking god so that's what that's for
time to unravel my goddamn spaghetti animation
[QUOTE=Hentie;47115425]oh my fucking god so that's what that's for
time to unravel my goddamn spaghetti animation[/QUOTE]
I had similar trouble. I worked for hours on a system that would switch from idle states to basic transitions using integers to activate them, and it seemed brilliant in my head. While trying to figure our why it just wouldn't work, I had a revelation.
[t]https://dl.dropboxusercontent.com/u/51353469/whoops.jpg[/t]
Almost 4 hours just to realize how fucking simple the solution was.
[editline]11th February 2015[/editline]
I plan out most of my stuff on paper before diving into Unity.
[QUOTE=Z_guy;47112685]There's a blue state barely visible in your image called "Any state", doing a transition from that state means that the transition can happen from any state in the state machine.[/QUOTE]
Seriously? OMFG I did it the same way as war_man333 did it (the retarded version for clarification).
Well I know now for next time :).
the Unity 5 beta event system looks really really clever. Has anyone here used it? What's your experience with it?
Quick question, I am trying to set the width of a panel based on the hp.
The problem is that the bar widthis 95px and the hp is 130, so how would I do to keep the 95px width but reduce the value based on the hp?
I tried some things but nothing worked so no point in posting it here.
[code]
public int Health;
public RectTransform HPPanel;
void Awake()
{
Health = 130;
}
void Update()
{
HPPanel.sizeDelta = new Vector2(Health, HPPanel.sizeDelta.y);
}
[/code]
Health Bar - 95px
[img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-11_17-37-33.png[/img]
[QUOTE=BoowmanTech;47120364]Quick question, I am trying to set the width of a panel based on the hp.
The problem is that the bar widthis 95px and the hp is 130, so how would I do to keep the 95px width but reduce the value based on the hp?
I tried some things but nothing worked so no point in posting it here.
[code]
public int Health;
public RectTransform HPPanel;
void Awake()
{
Health = 130;
}
void Update()
{
HPPanel.sizeDelta = new Vector2(Health, HPPanel.sizeDelta.y);
}
[/code]
Health Bar - 95px
[IMG]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-11_17-37-33.png[/IMG][/QUOTE]
Wouldn't that be BarWidth/MaxHealth * CurrentHealth, or 95/130 * 130 in your case
[QUOTE=Asgard;47120392]Wouldn't that be BarWidth/MaxHealth * CurrentHealth, or 95/130 * 130 in your case[/QUOTE]
Honestly idk, that's why I asked :D but I will give it a try and let you know.
Thanks
[editline]11th February 2015[/editline]
Ok so I tried and what happens is that when I press play the bar is the correct height the but doesn't change size based on the health.
[QUOTE=BoowmanTech;47120422]Honestly idk, that's why I asked :D but I will give it a try and let you know.
Thanks
[editline]11th February 2015[/editline]
Ok so I tried and what happens is that when I press play the bar is the correct height the but doesn't change size based on the health.[/QUOTE]
Double check you do:
[code]
HPPanel.sizeDelta = new Vector2((95/130) * Health, HPPanel.sizeDelta.y);
[/code]
You should replace the 95 and 130 with variables for bar width and max health respectively, because magic numbers are bad
[editline]11th February 2015[/editline]
Make sure you're using floats. This works:
[code]
using UnityEngine;
using System.Collections;
public class testlelel : MonoBehaviour {
public const float MaxHealth = 130;
public const float BarSize = 95;
[Range( 0, 130 )]
public float CurrentHealth;
// Use this for initialization
void Update () {
transform.localScale = new Vector3( ( BarSize / MaxHealth ) * CurrentHealth, 10f, 1f );
}
}
[/code]
[QUOTE=Asgard;47120163]the Unity 5 beta event system looks really really clever. Has anyone here used it? What's your experience with it?[/QUOTE]
You mean the UI events? Or what?
I worked with the UI Events and once you get a hang of it its really nice.
Basically its the best parts of WPF + WinForms :)
The only thing I'm missing is drawing the UI with stuff like DrawRectangle, FillRectangle etc.
But it should be easy to add that
Does anyone know how are this textures called?
Basically I want to look for textures that are drawn like this and I can't find any.
I thought it was 2.5D but couldn't find anything.
[img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-11_23-40-29.png[/img]
"Painted"?
It seriously looks like its a painting done with brush strokes
No, I mean the way it was made. It gives the impression that it's 2.5D/3D
If you mean how the game renders it to look as if it's 2.5D then you might want to take a look at Parallax Scrolling, Terraria does it, and it's a nice feature for 2D games.
I am not 100% sure if this is it but I also forgot to mention that I am talking about the terrain.
Basically since I can't find a designer I thought I should give it a try and make a terrain that looks 3Dish so it looks a lot better when making 2D games. But I couldn't find any tutorials on how to make it.
-snip- Nevermind. I wasn't thinking straight.
[QUOTE=BoowmanTech;47122494]Does anyone know how are this textures called?
Basically I want to look for textures that are drawn like this and I can't find any.
I thought it was 2.5D but couldn't find anything.
[/QUOTE]
Your question is very vague and difficult to answer. Do you mean something like this?
[img]http://upload.wikimedia.org/wikipedia/commons/1/16/Parallax-scroll-example.gif[/img]
Which is, as LuckyLuke said, parallax scrolling. Which is accomplished by using a multiple layers scrolling at different speeds to simulate depth.
I know my question is pretty vaque and I've been told that before :D
But no I want to know if the way the terrain was design has got a name so I could look it up.
Basically that is a normal picture that gives the impression that is 3D, basically the terrains has depth.
Also anyone knows why when I import a sprite in unity I have this lines at the edge of it?
[img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-12_01-21-58.png[/img]
[QUOTE=BoowmanTech;47123184]I know my question is pretty vaque and I've been told that before :D
But no I want to know if the way the terrain was design has got a name so I could look it up.
Basically that is a normal picture that gives the impression that is 3D, basically the terrains has depth.
Also anyone knows why when I import a sprite in unity I have this lines at the edge of it?
[img]https://dl.dropboxusercontent.com/u/16648713/ShareX/2015-02/2015-02-12_01-21-58.png[/img][/QUOTE]
Your sprite texture is set to Wrap. It should be set to Clamp instead.
[QUOTE=KillaMaaki;47123208]Your sprite texture is set to Wrap. It should be set to Clamp instead.[/QUOTE]
And if it's a sprite how do I change that to Clamp?
[QUOTE=BoowmanTech;47123239]And if it's a sprite how do I change that to Clamp?[/QUOTE]
Change the import type to Advanced
[editline]11th February 2015[/editline]
By the way, to answer your previous question, the painting is a perspective painting.
Oh ok, thanks.
[editline]12th February 2015[/editline]
Why is it so hard to find some perspective terrain textures? :(
Because the angle varies?
I mean, I guess you could google search it for a particular view point
Also, if you're doing parallax scrolling, make sure you don't make the same mistakes I made. Make sure you do as much optimizations as possible, like merging layers to reduce the amount of items requiring movement, and then scrolling the layers based on the perspective.
This is all unless it is handled by the gpu, in that case go nuts
I was thinking of switching from Darkbasic Pro to Unity3D. So I was tinkering with the engine, and I think the biggest hurdle will be the language (C# and Javascript).
Can anybody point me in the right direction to get started in those languages, for it to be useful in Unity3D? Or simple structures of the language as they're used in Unity3D?
I could dig around myself, but I think it would be quicker if somebody who had experience gave some pointers. I used to learn Darbasic Pro during my long holiday, but now I don't have that much luxury anymore with time :v:
[QUOTE=hakimhakim;47125159]I was thinking of switching from Darkbasic Pro to Unity3D. So I was tinkering with the engine, and I think the biggest hurdle will be the language (C# and Javascript).
Can anybody point me in the right direction to get started in those languages, for it to be useful in Unity3D? Or simple structures of the language as they're used in Unity3D?
I could dig around myself, but I think it would be quicker if somebody who had experience gave some pointers. I used to learn Darbasic Pro during my long holiday, but now I don't have that much luxury anymore with time :v:[/QUOTE]
Without going into any details, I'd say go with C# over Unityscript any day. Unityscript ("Javascript") is not a standard language and isn't quite as expressive as C#, it also takes far longer to compile for a big project. C#, on the other hand, has a huge plethora of online resources you can learn from, is a hugely powerful and expressive language, plus you can use it in all sorts of applications beyond just Unity.
EDIT: For instance, stuff like this: [url]http://www.microsoftvirtualacademy.com/training-courses/c-fundamentals-for-absolute-beginners[/url]
[QUOTE=Fourier;47119162]Seriously? OMFG I did it the same way as war_man333 did it (the retarded version for clarification).
Well I know now for next time :).[/QUOTE]
well I'm glad to know that even Fourier sometimes does things as dumb as I do.
Sorry, you need to Log In to post a reply to this thread.