I would like to achieve something like this:
I've already done something similar using the Unity particle system. It works fine but the problem is when you rotate the pointer, a wave is formed. Is there any other way?
If you want to avoid the wave using particle effects, you will need to move each particle immediately by how much it needs to move to get into its new position. The reason you get a wave now is because you're only changing the emitter's direction.
Instead, it might be a better approach to use a wrapped LineRenderer and scrolling the UVs on the texture/renderer on each Update using lineRenderer.material.SetTextureOffset. You'll also need to calculate the points to draw the line, and set those as appropriate in Update as well.
This way, when you change the aim, the LineRenderer's positions can all move accordingly and the dots will always appear to be in a series of straight lines.
Increase the speed of the Simulation Speed in the main (top) section of the Particle Settings. Try 10, to start with. You might need even higher. Default is 1.
Related
I m wondering that if is it possible to animate anything along the rules of physics.
I mean, i have a cube, and two legs attached to that cube. I want to just animate that legs one after each other, but unity or other software will force its animation system to behave to my animated legs to make my cube walk. I wont change positions for my body(cube) but legs will do that.
demonstration:
https://streamable.com/dda610
Yes, this animation type is called procedural animation. You base your animations dynamically based on physics.
https://en.wikipedia.org/wiki/Procedural_animation
good video:
https://www.youtube.com/watch?v=LNidsMesxSE
tutorial:
https://www.youtube.com/watch?v=9Wh6fzSl_u8
Physically based animation is a complex task. You can use the timeline to animate legs but they won't work too well physically. You probably want to use code to keep the body a fixed height above the surface and use the timeline editor to animate the legs. Or perhaps keep the body at the same height and use 'inverse kinematics' to move the legs in a more realistic fashion. Neither of these options will be very quick for you to start using really effectively if you have very little experience with unity or with code but knowing what to look up is half the battle of learning.
I'm trying to use a line renderer to act like a grappling cable for a vehicle of mine in my game. It seems, however, from the camera view the line is only visible up to a certain distance far away. Is there anything I can do to make the camera see more of the line?
EDIT: I should clarify, I know how to extend the length of the line, I have that script written. What I'm saying is that the line is hard to see from the camera when looking from behind. I want to give the player a good idea of how far the hook is going, even when it's over 30 units away on the forward z axis?
FURTHER:
When I turn my car to the side while moving with the line extended a distance, I can see much more of the line since I start to see the line from the side???
line renderer is a line between two points.
you just need to adjust the values under 'Positions'.
you can also click on the three dot icon at the top to 'edit points in scene view' and drag the further point outward, you can also add points with the plus icon beside it.
you could also use raycast for your grappling hook
I'm not super experienced with unity's linerenderer. However it looks like the linerenderer stops at your pink light barrier. I'm not sure if the linerenderer works like a raycast however.
EDIT:
Ok. Now I get what you want to achive. My guess is that unity does not render the line because it becomes smaller than a pixel and the lineRenderer is not a 3D element. I had some succes by using a different curve. Try to increase the width of the line the further away it is.
I'm trying to animate a hierarchy of 2D sprites (essentially body parts) by explicitly setting sprite positions at various key frames throughout a given animation clip. Unfortunately, Unity is implicitly changing all of the sprite positions using interpolation between key frames. This causes the sprites to look like they're sliding around rather than immediately transitioning into their correct positions.
So far I've come up with 2 rather poor solutions:
I could potentially create separate animation clips for each combination of sprite positions and transition
between them using mecanim parameters or in
code, but this seems tedious at best and inefficient at worst.
I could add more keyframes (either in the animator tab or in the
curves screen) that maintain each sprite position until just before
they need to be updated. This is a slightly better option but also
extremely tedious.
Is there any way to tell Unity to disable animation interpolation at least as far as positions are concerned? Thanks.
In the current version of Unity (2019.3), go to curves view, right click a keyframe node and select Left Tangent -> Constant. You may want to use Right Tangent depending on the use case. That should give you the instant change you're looking for.
Have you checked Brackeys video of animating 2D in Unity? Maybe it can help you :)
The following link is his video on how to animate 2D sprites.
https://www.youtube.com/watch?v=whzomFgjT50
Alright, I've come to the unfortunate conclusion that Unity forces you to use curves when dealing with animation keyframes and that you need to add an extra set of keyframes for abrupt shifts in animation.
Like this: https://i.imgur.com/9eCp1Mt.png
How can I get particles to spawn in a sphere, then move closer to the Y origin line as they move? I want to get a flame effect.
https://s3.envato.com/files/2472658/Fire_Flame_Preview_Image.jpg
Note how the flame in the middle goes higher. I want to replicate that. (Not replicate the image exactly, just achieve that 'air column' effect.
You could always just fake it, with a sizable density of particles travelling upwards, then you simply reduce the size over lifetime.
I know youtube videos are shunned on here. But this video is a good start.
If you wanted more control over the origin line, Unity still exposes the particlesystem through script.
I am trying to measure distance between multiple positions but I do not want the rotation to affect the distance. In concept, I want to track the starting transform and upon each update track the distance traveled without regard to the change in rotation. I am using an HTC Vive controller and people tend to rotate their hands and I want to control for this.
I've tried resetting the Eular Angles, but this doesn't seem to work.
Adding an Analogy that will certainly help.
Think of it like trying to draw and measure a line with a pencil, the position is in the eraser, and I can hold the pencil in any number of ways and in fact change the position in the middle of drawing the line, but my line will remain straight and the measurement will remain accurate.
Any help is appreciated.
I believe your problem lies around the position you are tracking. It sounds like you are tracking the transform.position of one of the child elements of the Vive controller model, leading to the situation that you're describing with the pencil eraser analogy.
Depending on where your script is attached, you could either move this to the top level element of the Vive controller, or alter your script to instead track transform.parent.position, which shouldn't be affected by the rotations of someone's hand.