Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Ideas966 · Dec 28, 2017 at 09:26 PM · unity 5rotationinputaiming

Problem getting "good-feeling" aiming with joysticks for a top-down shooter

Hello, I am currently making a 2v2 competitive game where each player can pick up and through stuff around. It takes place in 3D from an isometric perspective. here is a gyf of what it looks like and shows how jumpy the rotation is: https://gfycat.com/NegativeIllinformedIchthyosaurs

All of the aiming is done with the left stick, but it doesn't really feel great and sort of just snap between different angles instead of being a smooth 360 degrees. I'm having problems figuring out if it's a problem with either my actual controllers (all wireless 360 controllers), my code, or my input settings for the controllers.

This is the code that I use for aiming:

 direction.x = 1f * Input.GetAxis("Horizontal");
 direction.z = -1f * Input.GetAxis("Vertical");
 lookAngle = new Vector3(direction.x, 0, direction.z);
 Vector2 moveVec1 = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
  if (moveVec1.sqrMagnitude >= deadZone) //deadzone =.1
 {
         this.transform.rotation = Quaternion.LookRotation(lookAngle);
 }

I also use some code to smooth out the movement of the character model for aesthetic purposes which seems to actually help making the aiming smoother but it still feels like it's just moving between maybe "steps" and not actually giving me full 360 degree aiming.

the code for smoothing I use is this:

 targetAngle = Quaternion.LookRotation(lookAngle);
 targetAngle *= Quaternion.Euler(0, 90, 0); // used to making the "front" of the model look where the player is aiming
 if(canMove)
 {
 if(!GetComponent<dashNShoot2>().pointer.GetComponent<grabber>().holding)
 {
     Quaternion newRotation = Quaternion.Lerp(this.transform.rotation, targetAngle, rotateSpeed * Time.deltaTime);
     this.GetComponent<Rigidbody>().MoveRotation(newRotation);
 }
  else
 {
     Quaternion newRotation = Quaternion.Lerp(this.transform.rotation, targetAngle, rotateWhileHoldingSpeed * Time.deltaTime);
     this.GetComponent<Rigidbody>().MoveRotation(newRotation);
 }
 
 }

For my input settings I have snap enabled, gravity at 10, deadzone at 0, and sensitivity at 1. I've done a lot of research and tried a lot of different solutions but none have really worked for me. I used this article as a reference.

Any advice or suggestions on how to make my aiming feel better would be greatly appreciated.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

170 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

lerp to 0, problem with horizontal value 1 Answer

Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers

How to have a gameobject only rotate 180 degrees 3 Answers

Shift gear from 2 sliders? 1 Answer

How to Use Key Combinations with the Control-Key? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges