The perspective in Unity 2D - c#

I have issue with perspective in Unity. I'm just making a game alone and I have no idea how to fix the problem. I'm going to show you the problem on screenshots.
On the images, yellow color == collider lines
I want to go to the building closer.
I can't make collider like this:
Because it looks weird. I want it like this:
But to do this I have to change collider to something like this:
But there is still other issue... I can't go behind the building because the player won't "hide" behind the building like this:
Player will stop walking here:
I have no idea what to do now. I was trying to figure it out in any way. I was searching ideas/informations everywhere. I've run out of ideas, so I'm asking you here. Thank you in advance.

Related

Unity 2D collision only from above

Im trying to make a simple cloud jumping game with Unity 2D and have faced a problem.
How would i make the player go "through"/"in front of" the cloud when coming under but colliding when coming down again. Or do i need to trigger the jump action somehow when "touching" the cloud without collision?
Thank you in advance. I hope my text was understandable.
I have tried many ways, i don't even know what anymore. Like with ontrigger but idk did i do it right, it didn't work, something with adding a new layer, and polygon collider but how do i even edit it clearly?
I need help :')

Enemy Follow Unity 2d Jittering?

I am currently having trouble with my enemy AI Script. I am currently new to Unity, so I am still learning a lot, but when my player moves and my enemy follows the player, The enemy starts to jitter and I have yet to find a solution to this tiny problem.
Here are the things I've tried out:
I have Cinemachine attached to my player camera follow so I thought it might be that so I changed the Update method and BlendUpdate method to SmartUpdate and LateUpdate.
I tried interpolating the Rigidbody 2d on my enemy character, but it did nothing.
I tried coding the smoothing, (changed update to fixedupdate on Vector2.MoveTowards).
I tried searching for multiple different tutorials and tried all of them.
I looked at forums on the internet but they had outdated answers or no answer, or it was the wrong game engine.
I've been stuck on this problem for 2 weeks already and I feel like I can't move forward with development if I haven't figured this out. I removed my enemy follow script for now. I read in one of the forums that they may be animating on two different clocks, which I understand yet don't understand how to fix, so please do help!
Looks like I figured it out! instead of interpolating the Rigidbody2D on the enemy, I had to Interpolate the Rigidbody2D on the Player and now it's not jittering anymore :D

How to instantiate prefab of player shield so it will look like player is in a bubble?

I have a simple game in Unity and I have added some power ups. One of the power ups is a player
shield which instantiates on the player position and then follows him around. This shield is just a sphere with a transparency material. My problem is that when i instantiate shield it doesn't look like player was in the shield like in a bubble but it look like it is behind the shield. Can anyone help me out here?
Here Is the picture how it looks.
I want it to look like he is in a bubble. Can anyone help me out here?
Honestly, to me, it looks more like it is in front of the shield. Regardless, design-wise, there are four things that immediately come to mind:
Increase opacity of the bubble so that it clearly changes the color of the object inside of it
Give it an effect. Some sort of particle effect that sparkles or moves, therefore you will see it move across and behind the object within it
Ground it. have it hit the ground and result in a shadow. Shadows and a connection to the ground will provide a better perspective of where each item is
Give it a more reflective surface than the object inside it. Or change the dynamic so instead of the object reflecting light in the world, the shield does
This image conceptually shows a bit of what I referring to. Also, when it comes to design ideas, reddit is an awesome place to get opinions. r/Unity3d has a ton of helpful and friendly people that like to see people's ideas and are more than willing to comment on design. Rather than here, where it is much more programming oriented.
Hope this helps!

Animation Controller/Scripting in Unity

I am working on a 2.5D side scroller/platformer project just kind of as a learning experience. I imported a robot model that came with premade animations. I have 2 questions regarding setting him up for movement and his animations. First, I set up movement for x and y, but do I only need to do x? Right now if I hit the UP arrow, the character appears to jump, but feel like that is probably bad form. Am I correct in assuming I should do just the x value for movement and create a separate method for jumping? My second question is with the animation controller. I set up all my states and set my transitions, but I'm not sure what to do from there. What do I do to actually set up the transitions, if anything, and also I could use some information on setting up the animations on the programming side. I have some very slight general knowledge of it, but not much and I'm having trouble finding good solid tutorials for these specific questions.
Thanks for the help!
Yes, I would recommend doing separate controllers and script files for side to side moving and jumping. That way if you ever need to change one of those behaviours you have a specialized place to do it. Also, perhaps you have an enemy that moves side to side but doesn't jump. Or perhaps something that jumps but doesn't move. You could just drag the correct behaviour onto the game object.
as for animations, the unity learn tutorials are pretty helpful getting you started on animations and very basic state transitions

c# wpf 2d animation: Storyboard

I am new to Silverlight but you have to start somewhere right?
For my school project I am working on a projectile simulator but I am stuck as to what to do for the 2D animation. when looking at a storyboard most of the examples have very little example for moving the object. Is using a storyboard a good idea for this type of animation or am I doing this completely wrong?
no idea what part of my code to put here so ask and ill edit.
thanks for your help!

Categories