Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Jan 22, 2021 at 11:05 PM by RandumbGuy for the following reason:

resolved my issue

avatar image
0
Question by RandumbGuy · Jan 22, 2021 at 08:50 PM · rigidbodywall jumpwalljump

3D wall jump almost working

So I've been trying to make a wall jump for my game for a while now, and nearly found a solution. With this script, you can detect when a wall is near you, where the wall is and when you press the space bar It shoots you up and the direction the wall is facing. The problem is that when you actually do wall jump it's almost instant as if you teleported. Any suggestions or possible fixes? Any answers are appreciated.

Movement Script:
void FixedUpdate() {
moving = Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D);

     if (moving)
     {
         transform.localRotation = Quaternion.Euler(0, Camera.rotation.eulerAngles.y, 0);
     }

     float x = Input.GetAxisRaw("Horizontal");
     float y = Input.GetAxisRaw("Vertical");

     Vector3 move = (transform.right * x + transform.forward * y);

     move.Normalize();

     rb.velocity = new Vector3(move.x * speed * Time.deltaTime, rb.velocity.y, move.z * speed * Time.deltaTime);

     onGround = Physics.CheckSphere(new Vector3(transform.position.x, transform.position.y - 1, transform.position.z), spSize, Environment);
 }

Wall Check:

private void CheckForWall() // called every update { isWallRight = Physics.Raycast(transform.position, transform.right, 0.73f, Environment);

     if (isWallRight)
     {
         wallJump = -transform.right * jumpForce;
         canWallJump = true;
         Debug.Log("Right Wall");
     }

     isWallLeft = Physics.Raycast(transform.position, -transform.right, 0.75f, Environment);

     if (isWallLeft)
     {
         wallJump = transform.right * jumpForce;
         canWallJump = true;
         Debug.Log("Left Wall");
     }

     if (!isWallLeft && !isWallRight)
     {
         canWallJump = false;
     }
 }

And finally the wall jump:

private void WallJump() { rb.AddForce(jump 15, ForceMode.Impulse); rb.velocity = Vector3.zero; rb.AddForce(wallJump wallJumpForce, ForceMode.VelocityChange); speed = jumpSpeed;

void Update() { rb.AddForce(0, -gravity * Time.deltaTime, 0);

     CheckForWall();

     if (Input.GetKeyDown(KeyCode.Space) && onGround == true)
     {
         speed = jumpSpeed;
         onGround = false;
         rb.AddForce(jump * jumpForce, ForceMode.Impulse);
     }

     if (Input.GetKeyDown(KeyCode.Space) && canWallJump && moving)
     {
         WallJump();
     }
 }
 }
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

  • Sort: 
avatar image
0

Answer by Quazaar_studios · Jan 22, 2021 at 09:22 PM

No matter how you change the speed, it teleports? Have you tried that?

Comment
Add comment · Show 2 · 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
avatar image RandumbGuy · Jan 22, 2021 at 10:01 PM 0
Share

Nope ive tried setting the speed to 1 but it still doesnt work

avatar image Quazaar_studios RandumbGuy · Jan 22, 2021 at 11:33 PM 0
Share

Try setting it to an even smaller float, like .1 or .001, maybe your velocity is so high you see the player as if it teleported.

Follow this Question

Answers Answers and Comments

156 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

Related Questions

How do I make a rigidbody 3D wall jump? 1 Answer

How do I make a Rigidbody 3D wall jump? 1 Answer

Rigidy body 3d wall jump 0 Answers

problems setting up wall jump 1 Answer

3d wall jumping with charter controller 1 Answer


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