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 MrGurbiful · Aug 17, 2019 at 12:46 AM · movementinputrelative movement

Camera relative movement (CharacterController.Move) in one axis and local transform

Hello there, I have done a construction to climb and move along edges and another one for pushing objects. The problem is the inputs. I already have relative to camera movement but in this case I couldn't figure out how to implement this. Because I use the normals from the wall on which the player is hanging to rotate towards the wall, so I can move in the left or right Direction. (The player is constantly moving forward to be in front of the wall and to get the normal)

 Vector2 LedgeInput = input;
 LedgeInput.y = 0;
 LedgeInput = LedgeInput.normalized;
 
 Vector3 moveDirectionLedge;
 
 moveDirectionLedge = LedgeInput * Time.deltaTime * 2;
 moveDirectionLedge = transform.TransformDirection(moveDirectionLedge);
 
 if (LedgeInput.x < 0.9f && canUseInput && isLeftSideFree)
 {
     anim.SetBool("LedgeLeftPressed", true);
     cController.Move(moveDirectionLedge);
 }
 else
 {
     anim.SetBool("LedgeLeftPressed", false);
 }
 if (LedgeInput.x > -0.9f && canUseInput && isRightSideFree)
 {
     anim.SetBool("LedgeRightPressed", true);
     cController.Move(moveDirectionLedge);
 }
 else
 {
     anim.SetBool("LedgeRightPressed", false);
 }


Because of this I need local Transform. And the other problem is, I only use left and right (xAxis) to move along edges.

And for the pushing thing it's almost the same. There I use the yAxis.

Maybe someone can tell me and explain how I can make this.

I hope you can Understand me.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MrGurbiful · Aug 18, 2019 at 02:38 PM

Now I have this:

 Vector2 LedgeInput = camForward * input.y + camRight * input.x;
 LedgeInput.y = 0;
 LedgeInput = LedgeInput.normalized;
 
 Vector3 moveDirectionLedge;
 
 moveDirectionLedge = LedgeInput * Time.deltaTime * 2;
 moveDirectionLedge = transform.TransformDirection(moveDirectionLedge);
 
 if (canUseInput && isLeftSideFree)
 {
     anim.SetBool("LedgeLeftPressed", true);
     cController.Move(moveDirectionLedge);
 }
 else
 {
     anim.SetBool("LedgeLeftPressed", false);
 }
 if (canUseInput && isRightSideFree)
 {
     anim.SetBool("LedgeRightPressed", true);
     cController.Move(moveDirectionLedge);
 }
 else
 {
     anim.SetBool("LedgeRightPressed", false);
 }

It isn't the solution but I am near to it. Maybe now someone have an idea?

Comment
Add comment · Share
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

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

178 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Input System Can't Catch Event on Update 0 Answers

OnMove Vector2 never returns to (0,0) 1 Answer

Why am I losing some inputs on Update function? 0 Answers

How to make a object go and come back with a mouse click 1 Answer

drag to move object in perspective camera 0 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