#rot problem
1 messages · Page 1 of 1 (latest)
hello
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movement : MonoBehaviour
{
public void Update()
{
GetInput();
}
public void GetInput()
{
m_horizontalInput = Input.GetAxis("Horizontal");
m_verticalInput = Input.GetAxis("Vertical");
}
private void Steer()
{
m_steeringAngle = maxSteerAngle * m_horizontalInput;
Steering.transform.eulerAngles = new Vector3(Steering.transform.eulerAngles.x, m_steeringAngle, Steering.transform.eulerAngles.z );
}
private void accelerate()
{
rearDriverW.motorTorque = m_verticalInput * motorForce;
}
private void UpdateWheelPoses()
{
UpdateWheelPose(frontDriverW, frontDriverT);
UpdateWheelPose(rearDriverW, rearDriverT);
}
private void UpdateWheelPose(WheelCollider _collider, Transform _transform)
{
Vector3 _pos = _transform.position;
Quaternion _quat = _transform.rotation;
_collider.GetWorldPose(out _pos, out _quat);
_transform.position = _pos;
_transform.rotation = _quat;
}
private void FixedUpdate()
{
GetInput();
Steer();
accelerate();
UpdateWheelPoses();
}
private float m_horizontalInput;
private float m_verticalInput;
private float m_steeringAngle;
public WheelCollider frontDriverW;
public WheelCollider rearDriverW;
public Transform frontDriverT;
public Transform rearDriverT;
public float maxSteerAngle = 30;
public float motorForce = 50;
public Transform Steering;
}
@naive sinew
here is my code
what's wrong with it again? I remember we had wheel working
i started again from zero
because my unity crashed
and everytime i try to open it crashes
so i started again
@naive sinew
aw man..
always save, and make backups every hours or so
maybe use GIT but otherwise , i literally ZIP my main project every hour just to have copies offline
why did u delete old thread, the working code was there..
ok but the changes we made are there
Steering.transform.eulerAngles = new Vector3(Steering.transform.eulerAngles.x, m_steeringAngle, Steering.transform.eulerAngles.z );
yes i had my whole code saved in pastebin
so i didnt have to write it again
ok now to my problem
why are wheels at wrong rotation
how do i know ?
lol
if it didnt save something got moved or not saved, u gonna have to refix it
do you have any video from yesterday or u can see how u had the inspector setup ?
its exactly the same
if you didnt save something you have to literally trace back everything u did before u got to that point of wheel itself
well obv not if its messed up
ok