unity jump
C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class jump : MonoBehaviour
{
public float jumpHeight = 7f;
public bool isGrounded;
public float NumberJumps = 0f;
public float MaxJumps = 2;
private Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
if (NumberJumps > MaxJumps - 1)
{
isGrounded = false;
}
if (isGrounded)
{
if (Input.GetButtonDown("Jump"))
{
rb.AddForce(Vector3.up * jumpHeight);
NumberJumps += 1;
}
}
}
void OnCollisionEnter(Collision other)
{
isGrounded = true;
NumberJumps = 0;
}
void OnCollisionExit(Collision other)
{
}
}
rb = GetComponent<Rigidbody>();
rb.AddForce(new Vector3(0,100f,0));
Also in C#:
- Title
- mvc input type file
- Category
- C#
- Title
- how to reference function in unity
- Category
- C#
- Title
- eager loading c#
- Category
- C#
- Title
- how to get array of children transform
- Category
- C#
- Title
- change partial view based on select asp.net core
- Category
- C#
- Title
- in unity i want to destroy a gameobject when it hits the edge of the screen
- Category
- C#
- Title
- json serialize object capitalization config
- Category
- C#
- Title
- c# check if type implements interface
- Category
- C#
- Title
- how to a equall to b in c#
- Category
- C#
- Title
- c# index in select
- Category
- C#
- Title
- get random point within radius
- Category
- C#
- Title
- how to deactivate objects through scripts in unity
- Category
- C#
- Title
- call Textboxfor in cs
- Category
- C#
- Title
- c# System.Resources.MissingManifestResourceException error
- Category
- C#
- Title
- C# get pc language
- Category
- C#
- Title
- isdaylightsavingtime in c#
- Category
- C#
- Title
- create asp.net which send email and sms using own api
- Category
- C#
- Title
- create object in c#
- Category
- C#
- Title
- get last element of array c#
- Category
- C#
- Title
- how to make % posibility to spawn an object C# in unity
- Category
- C#
- Title
- use newtonsoft json to clone object
- Category
- C#
- Title
- unity rotate around axis
- Category
- C#
- Title
- unity how to see what scen you are in
- Category
- C#
- Title
- unity oncollisionenter2d
- Category
- C#
- Title
- c sharp split by newline
- Category
- C#
- Title
- datagridview select row column cell c#
- Category
- C#
- Title
- c# iorderedenumerable to dictionary
- Category
- C#
- Title
- unity list length
- Category
- C#
- Title
- : ? conditioanl statement c#
- Category
- C#
- Title
- escape double quotes c#
- Category
- C#
- Title
- import regex c#
- Category
- C#
- Title
- uwp file open picker
- Category
- C#
- Title
- Failed to retrieve Firebase Instance Id
- Category
- C#
- Title
- .net directorysearcher get manager accountname
- Category
- C#
- Title
- c# contextswitchdeadlock
- Category
- C#
- Title
- unity detect any key
- Category
- C#
- Title
- C# public 2d array
- Category
- C#
- Title
- .sh script: check if file exist
- Category
- C#
- Title
- variables
- Category
- C#
- Title
- show double in textbox c#
- Category
- C#
- Title
- unity key detection
- Category
- C#
- Title
- c# loop through two dimensional array
- Category
- C#
- Title
- asp.net get query string parameter
- Category
- C#
- Title
- mvc write to console
- Category
- C#
- Title
- unity making homing missile
- Category
- C#
- Title
- c# silent execute exe
- Category
- C#
- Title
- xamarin forms alarm
- Category
- C#
- Title
- c# compare type
- Category
- C#
- Title
- unity gizmo draw line
- Category
- C#
- Title
- c# format string to date yyyymmdd
- Category
- C#
- Title
- repeater itemdatabound event in c#
- Category
- C#
- Title
- c# creating exceptions
- Category
- C#
- Title
- unity add sections to a list
- Category
- C#
- Title
- unity lerp
- Category
- C#
- Title
- c# properties
- Category
- C#
- Title
- c# get directory part of path
- Category
- C#
- Title
- C# .net core convert to int round up
- Category
- C#
- Title
- transform.translate unity
- Category
- C#
- Title
- c# convert Unix time in seconds to datetime
- Category
- C#
- Title
- c# cancellationtoken
- Category
- C#
- Title
- change canvas color uwp c#
- Category
- C#
- Title
- how to randomly rotate rigidbody of object in unity
- Category
- C#
- Title
- c# class declaration
- Category
- C#
- Title
- out parameters c#
- Category
- C#
- Title
- get variable from another script unity
- Category
- C#
- Title
- newtonsoft create dynamic object
- Category
- C#
- Title
- Movement 2d unity
- Category
- C#
- Title
- create line in unity
- Category
- C#
- Title
- chase object unity
- Category
- C#
- Title
- get what week of the month c#
- Category
- C#
- Title
- get web config key value in c# razor view
- Category
- C#
- Title
- c# null conditional
- Category
- C#
- Title
- how to set progress openedge driver name for odbc connection c#
- Category
- C#
- Title
- how to pass object as test case in nunit c#
- Category
- C#
- Title
- percentage in c#
- Category
- C#
- Title
- c# dictionaries
- Category
- C#
- Title
- input get button uibutton
- Category
- C#
- Title
- c# creating and throwing exceptions
- Category
- C#
- Title
- Update data in db .net
- Category
- C#
- Title
- how to pass an optional parameter in c# mvc asp.net
- Category
- C#
- Title
- unity get velocity at point
- Category
- C#
- Title
- .netstandard distinctby iqueryable
- Category
- C#
- Title
- c# remove character from string at index
- Category
- C#
- Title
- how to stop window from terminating c# visual studio
- Category
- C#
- Title
- how to make a datatable in c#
- Category
- C#
- Title
- c# string replace comma with newline
- Category
- C#
- Title
- how to make a pause feautre in unity
- Category
- C#
- Title
- c# asp.net hover tooltip
- Category
- C#
- Title
- 2d movement unity
- Category
- C#
- Title
- how to work with ascii in c#
- Category
- C#
- Title
- disable a component unity
- Category
- C#
- Title
- unity html request
- Category
- C#
- Title
- how to find object by ag unity
- Category
- C#
- Title
- count number of enum values C#
- Category
- C#
- Title
- block wapalyzer from detecting codeigniter
- Category
- C#
- Title
- c# half hour dropdown list
- Category
- C#
- Title
- c# checksum
- Category
- C#
- Title
- .net core session
- Category
- C#
- Title
- unity if gameobject exists
- Category
- C#
- Title
- c# exit console
- Category
- C#