I am making a mobile version of my game and I have a joystick and panel with scripts that allow the standard RigidbodyFirstPerson move and rotate with some tweaking of their original code (adding RunAxis and JumpAxis) but as many times as I’ve tried I can’t get the jump to work, I don’t think the code works for it. I followed this video
and have spent so long trying to get this darn thing to work. If I can get any suggestions I would really appreciate it. Is there another script I could create to just make it jump with a mouseclick
I ended up taking all the jump scripting from this tutorial and tried my own code. It doesnt work either, this is it
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class MoveUp : MonoBehaviour
{
public Rigidbody rb;
void Start()
{
rb = GetComponent();
}
public void OnPointerDown(PointerEventData eventData)
{
transform.Translate(0, 10, 0);
}
}
Im new to scripting, probably doing it completely wrong but I thought there might be a way to do it like this, but not sure
First, please use code block. It’s that "Code: " section in the editor. Makes it so much readable and doesn’t require much more than cut’n’pasting the code as normal text here.
Please open the reference manual and read the RigidBody section. Generally you want to move RigidBodies so that you apply move forces, like this: