#Transform movement vs Rigidbody movement
1 messages · Page 1 of 1 (latest)
Ohhhhh :o
{
[SerializeField] private Rigidbody _rigidBody;
[SerializeField] private float _speed = 25;
[SerializeField] private float _turnSpeed = 720;
[SerializeField] private Transform _model;
private Vector3 _input;
private void Update()
{
GatherInput();
Look();
}
private void FixedUpdate()
{
Move();
}
private void GatherInput()
{
_input = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
}
private void Look()
{
if (_input == Vector3.zero) return;
Quaternion rot = Quaternion.LookRotation(_input.ToIso(), Vector3.up);
_model.rotation = Quaternion.RotateTowards(_model.rotation, rot, _turnSpeed * Time.deltaTime);
}
private void Move()
{
_rigidBody.MovePosition(transform.position + _input.ToIso() * _input.normalized.magnitude * _speed * Time.deltaTime);
}
}
public static class Helpers
{
private static Matrix4x4 _isoMatrix = Matrix4x4.Rotate(Quaternion.Euler(0, 45, 0));
public static Vector3 ToIso(this Vector3 input) => _isoMatrix.MultiplyPoint3x4(input);```
Like where it has a serrialized field
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
gotcha
One message removed from a suspended account.
Nope
when i run around, i just float on a plane i set it on
like lets say i am on like 5 feet up on the y axis
ill be moving along that 5 ft
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
may i perhaps call ya to show? maybe that will help?
One message removed from a suspended account.
wait add csharp?
One message removed from a suspended account.