Answer the question
In order to leave comments, you need to log in
Error CS1061: 'Vector3' does not contain a definition for 'transform' and no accessible extension method 'transform how to fix?
How can I fix this code so that it works?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerST : MonoBehaviour
{
public GameObject camera;
public float speed = 20f;
public Joystick joystick;
Rigidbody rb;
// Start is called before the first frame update
void Start()
{
rb= GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
}
void FixedUpdate(){
rb.AddForce(camera.transform.forward * joystick.Vertical * speed, 0f, camera.transform.right * joystick.Horizontal * speed);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question