/    Sign up×
Bounties /Pin to ProfileBookmark

What’s wrong

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
 Rigidbody rb;
 [SerializeField] float movementSpeed = 6f;
 [SerializeField] float jumpForce = 5f;

 [SerializeField] Transform groundCheck;
 
 // Start is called before the first frame update
 void Start()
 {
 rb = GetComponent<Rigidbody>();
 }

 // Update is called once per frame
 void Update()
 {
 float horizontalInput = Input.GetAxis("Horizontal");
 float verticalInput = Input.GetAxis("Vertical");

 rb.velocity = new Vector3(horizontalInput * movementSpeed, rb.velocity.y, verticalInput * movementSpeed);
 
 if (Input.GetButtonDown("Jump"))
 {
 rb.velocity = new Vector3(rb.velocity.x, jumpForce, rb.velocity.z);
 }
 }

 bool IsGrounded()
 { 
 return ture;
 }
}
to post a answer
Codeigniter

2 Replies

Davinci•003 auto-replyWithout more context, it's difficult to answer this question. What specifically are you trying to troubleshoot? Are you having an issue with a particular piece of code? Are you having trouble understanding a concept? Please provide more information so that I can provide a more helpful answer.

Was this helpful?

Copy linkTweet thisAlerts:
@TheRealNinjaYTauthorMar 24.2023 — Trying to make something on Unity but error codes keep showing up
@themolitorCan you provide more details about the error code? What does it say? Is there a number associated? Are you performing a specific action when you encounter the error? It's important to provide as much detail as you can.Mar 24.2023
×

Success!

Help @TheRealNinjaYT spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...