GithubHelp home page GithubHelp logo

dbrizov / naughtycharacter Goto Github PK

View Code? Open in Web Editor NEW
968.0 27.0 141.0 360.7 MB

Third Person Controller for Unity

License: MIT License

C# 64.33% ShaderLab 35.67%
unity3d character controller third-person

naughtycharacter's Introduction

NaughtyCharacter

Third Person Controller for Unity.

gif gif gif gif

System Requirements

Unity 2018.3.0 or later versions.

Controls

Keyboard And Mouse

  • Movement: WASD
  • Camera: Mouse
  • Jump: Space

XBOX 360/ONE Controller

  • Movement: Left Stick
  • Camera: Right Stick
  • Jump: A

License

The MIT License (MIT)

Copyright (c) 2015 Denis Rizov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

naughtycharacter's People

Contributors

dbrizov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

naughtycharacter's Issues

Character velocity bug, when no joystick controller is plugged in (In slow-motion only)

When in slow-motion sometimes the character's horizontal velocity goes to 0.0 for a single frame and a transition to Idle state starts. This creates an effect as if the character is faltering for a sec. When I plug in a controller before I start Unity the bug fixes. Then when I unplug the controller while the Unity Editor is running, the bug is still fixed.

  • I've created a workaround, so that the "HorizontalSpeed" property of the character does not return the magnitude of the horizontal velocity of the character, but instead returns the calculated "currentHorizontalSpeed".

Edit: I found out what the problem is. The CharacterController component internally stores the last two positions of the character and the time that was needed for the character to move from the first position to the second position. This information is enough so that the velocity of the character can be calculated. In slow motion however, these two positions sometimes are equal, because the character is moving really slowly. This way the calculated velocity results in 0.0, and the Idle animation of the character start to play for a single frame. However I don't know why this bug is present only when no joystick controller is plugged in.

Vector math problem

I want to say thanks for DrawGizmoSphere function in SpringArm.cs. I am using it in external resources for drawing wire sphere, since there is no quaternions there, I just swapped y and z coords inside GetSphericalPoint function and it works great.
I want to draw a circle shape around given normal, by default my points are in XZ plane and I want to achive flexible way to position it (same as https://docs.unity3d.com/ScriptReference/Handles.DrawWireDisc.html)

// here is my unity code but same calculations applied in javascript
Vector3[] positions = new Vector3[Count];
float stepSize = 360f / Count;
for (int i = 0; i < positions.Length; i++)
{
    float angle = i * stepSize * Mathf.Deg2Rad;
    positions[i].x = Mathf.Sin(angle) * Radius;
    positions[i].z = Mathf.Cos(angle) * Radius;
}

It would be great if you can help me ๐Ÿ˜„

Here is some screenshots (manually changed coords)

Normal - Vector3.up
vector normal up

Normal - Vector3.forward
vector normal forward

Normal - Vector3.right
vector normal right

Thanks

You are my hero, tks for the open source work. I will try to include your code into my project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.