Hello, I want to create this kind of movement, but i am not sure how to do it, at the momento i am doing the zig zag movement like this exmple
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VirusMove : MonoBehaviour
{
public float speed = 2;
float frequency = 10.0f; // Speed of sine movement
float magnitude = 0.5f; // Size of sine movement
Vector3 pos;
Vector3 axis;
private void Awake()
{
pos = transform.position;
axis = transform.up;
}
void Update()
{
pos += Vector3.left * Time.deltaTime * speed;
transform.position = pos + axis * Mathf.Sin(Time.time * frequency) * magnitude;
}
The zig zag movement is ok, but i can’t find the solution for the rotation that i desired.
What would be a googd solution for this issue?