move

sooo hi im back from summer break and now I have got to get working and problem :eyes: so the script is not allowing with object to move freely so I need help

sing UnityEngine;
using System.Collections;

// Makes objects float up & down while gently spinning.
public class Floater : MonoBehaviour
{
    // User Inputs
    public float degreesPerSecond = 15.0f;
    public float amplitude = 0.5f;
    public float frequency = 1f;

    // Position Storage Variables
    Vector3 posOffset = new Vector3();
    Vector3 tempPos = new Vector3();

    // Use this for initialization
    void Start()
    {
        // Store the starting position & rotation of the object
        posOffset = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        // Spin object around Y-Axis
        transform.Rotate(new Vector3(0f, Time.deltaTime * degreesPerSecond, 0f), Space.World);

        // Float up/down with a Sin()
        tempPos = posOffset;
        tempPos.y += Mathf.Sin(Time.fixedTime * Mathf.PI * frequency) * amplitude;

        transform.position = tempPos;
    }
}

p.s my game is soon going to be tested soon so the test version will come out soon:)

Can you be more specific? I can see what the script is supposed to be doing (spinning and floating), but what is it doing now that is incorrect?

It is not doing anything wrong but I want the objet move with the camra but it is"int

“Move with the camera” can mean many different things. Please, describe what you’re trying to do in specific terms. We can’t read your mind or peer into your computer. Being vague only hurts you. Diagrams are always welcome.

Whatever it means, this is likely the best choice for newer users:

Camera stuff is pretty tricky… it might be best to use Cinemachine from the Unity Package Manager.

https://drive.google.com/file/d/149Ak-qUIQCwU8Y1JhDWS_00cytxabgU2/view?usp=sharing

That file is not public.

https://web.microsoftstream.com/video/7b1bf404-ac11-4032-a432-17978c69afce there I think this will work

This file is not public either. Streamable.com is a good public site to upload video to.

0vtlxf ok thx for the help this vide if me showng you my problem

thx I have the file up now