I am still new to Unity and programming in general. I have tried looking through the forums for this problem but I feel the need to ask anyways since I get confused reading and trying to tell if the person's problem is exactly the same as mine. I have this code that when you press w which is forward it forces the the player to go forward in one direction regardless of where the player is facing. I know this kind of thing has been talked about before but I want to know exactly where I am messing up. Maybe something with using Space.World instead of Self or combining vectors and transform. Any help would be appreciated.
Screenshot of the code:
Related
Ok, so I've been playing a lot of Devil May Cry 1 recently and I found out that I really like third person Hack and Slash games. So I wanted to make something similar using Unity. The character controller I've set up works pretty well for my needs. There is just one problem. The third person camera (Free Look Camera) has like this weird FieldOfView-Change whenever the character is moving.
Click here to see what it looks like right now!
I tried fixing that by changing its properties on the side but it didn't help at all, heck, it even got worse.
Maybe there is a really simple solution for it but I didn't get there.
All I want the camera to do is follow the player smoothly (which it does) but without doing that weird Snap-Back-In-Place-After-Player-Has-Stopped-Thingy (which it does not).
Have you guys got any ideas?
Thx, Anton
The problem is with Cinemachine. From the camera, I can tell this is what you're using. Cinemachine has a lot of options, but you need to locate damping and turn that off if you don't want that delay.
Hopefully this resolves your issue!
I am new to Unity, and I want to make a 3d character movement. Please help me. I have tried tutorials, but they don't work.
You first have to choose what kind of movement you want to accomplish i.e: 1st person, 3rd person etc. And saying that YouTube tutorials don't work definitely means you are missing something. Here are some good tutorials for different 3d movement. Please follow them thoroughly.
1st Person:
https://www.youtube.com/watch?v=_QajrabyTJc
https://www.youtube.com/watch?v=XAC8U9-dTZU
3rd Person:
https://www.youtube.com/watch?v=4HpC--2iowE
You can find a ton more movement systems on Google.
Your movement depends on your usage. You have to use a different approach if you want it to be Character Controller based than Rigidbody based. So learn the basics, and then experiment on your own until you are happy with it.
There are tons of ways to make a player move in 3D, and there are just as many tutorials that explain it. If you need a place to start, see the character controller component.
If you have a 3d model of the character, just add this component and it will start moving right away.
the gameobject does not have to have rigidbody or collider components, because it takes care of the whole character controller.
If I gave you a hand to get started, you can mark my answer as accepted, and vote it positively :)
For my university project I am making a program to help test children's motor skills. Its basic ball catching/throwing tests, but there are certain steps involved, eg, for an underarm throw the movement goes as follows:
dominant hand swings down and back reaching behind the leg
steps forward with the foot opposite the throwing hand
ball is tossed forward hitting the wall without a bounce
hand follows through after ball release to chest level
For these detections I am initially thinking of buffering a list of points before each 'step' of positions and then checking each one over for that step to be performed.
Is there any elegant way of doing this? Any mathematical way that isn't a neural network?
My proposed method feels a bit crude, so i'd love input from anyone else.
Thanks!
Ive got - 2 on this questions so obviously i shouldn't be asking such a ridiculous question on here. Its fine. Ill figure it out.
I'm developing a game in SceneKit (iOS 13) and I want to add realism to the movements of the character.
The character has hair with a skeleton-bones, so I can make it bounce programmatically. I want to rotate the bones in a natural way so the hair bounces.
What's the best approach for this? As soon as there is no-movement, I want the bones to return to the original position.
Here is a reference of how bones are placed:
After some research and surfing the web I found an example of exactly what I want to achieve, and it's called: Inverse Kinematics
Hope it helps anyone who wants to achieve this. Here is a GitHub repo I found by Robert-Hein Hooijmans.
https://github.com/roberthein/InverseKinematics
(I don't know why it got -1. Either I didn't explain myself correctly or people are being subjective. Yes it's a rant.) (If anyone here can tell me the reason they think it got -1, let me know!, I'm here to learn how to post)
I am making a multiplayer top down 2D game with 3d elements. All my movement, healthbars and basic functionality is working flawlessly even while hosted and playing on a server, node.js socket.io. However In this game it is possible to move the camera like in Realm of the mad god.
in case you are in doubt here is a video: https://youtu.be/4tdcxl3aZ0c?t=31s
This of course means that the players can end up being upside down with regards to each other and I cannot find a solution that works in all regards to make sure the sprites of the other players are always facing the correct direction with regards to their movement.
I have made several solution to this problem which cover most scenarios but while play testing other things we always end up noticing that the sprites sometimes face the wrong directions. So I am wondering if anyone has an answer, the logic, the fixing this problem.
Things I have tried:
Adding a gameobject to the camera to which all sprites asses their change in distance and determine their facing direction based off that information. (this leads to the players sometimes flipping erratically when the camera is moved and they as well are moving as sometimes they may be moving slower and there although moving left the camera approaches from the right and that flips them)
Adding a gameobject to the world which allows all sprites to have a fixed point to which they can measure their change in distance and therefore also know what direction to face (this worked somewhat better as they always know what direction they have to face, however once the player is upside down everything is inverted)
Emitting to the other players wether I am upside down or not in order to try to reinvert the above solution in the case I am upside down. (I could not find a good way to do this, and it got me thinking that this must be a problem people have fixed before many times and perhaps someone know of a good solution that works.)
thank you all for your input.
I seem to have found a solution for this issue that works decently well. Keeping in mind that I do not want to have the server being involved in this and I would rather have each individual sprite know its direction rather that have something heavy trying to determine this logic I came up with the following solution. May not be the best but it works. Still very keen to hear other solutions.
On my main character I have a switch case, which changes depending on the players rotation in the world. I need this switch case anyway for fixing (http://answers.unity3d.com/questions/1348301/trying-to-change-the-cameratransparencysortaxis-to.html?childToView=1348316#answer-1348316) that issue.
As the cases change I simply place the gameobject that I want the sprites to compare their distance to at 1 of 4 positions. YPos, YNeg, XPos, XNeg. Meaning that the sprite now determines its facing direction based on a gameobject that is placed in accordance with the Players position. without having to place it on the camera.
I will update if during further play tests this gives me trouble but thus far it works in the all the cases I need it to.
Still very willing to hear other solutions to this problem.
Thank you.