Get position of object that uses Perlin Noise X distance/time back/offset?
Not sure if I'm going about this the right way, but I'm looking to get the X position of an object where it WAS either in an amount of distance, time or frames back. I think preferably distance back... but there is another factor (the perlin noise is slowly changing, speeding up)
let me try to explain a little better.
I have objects that are being randomly Instantiated at the x position of an object using this code (this code is on the "wiggler" object that everything spawns from):
void Update()
{
float movement = GlobalControl.newPathCurveAmount * Mathf.PerlinNoise(Time.timeSinceLevelLoad * GlobalControl.newPathCurveSpeed, 0.0F);
Vector3 pos = transform.position;
pos.x = movement - (GlobalControl.newPathCurveAmount/2);
transform.position = pos;
}
What I'm trying to do is get the x position of that random perlin noise/"wiggler" object position of where it WAS 500 units back. (The player and camera are at z: 0, the spawner is at z: 500)
I might not be thinking about this right because the spawner is slowly speeding up (GlobalControl.newPathCurveSpeed slowly increasing) and the objects are slowly moving faster and faster (not sure this matters, though.. the path should stay the same think).
My end goal is to have the camera (at z:0) follow the path this perlin noise spawner is creating 500 units back in z space, sort of to show where the player "should have been".
I really hope that makes sense.
Quick detail: the perlin noise is on an object ("wiggler") and I take that X position to spawn obstacles on the left and right, essentially creating a wall of obstacles and a path that the player follows (left and right movement only)... when the player dies I'd like the camera to follow the path that the player "should have been on" - I'm just a little confused how to go about this and not sure if the speeding up of the curve amount will affect this or not? Really don't know how to go about this at all.
Any help or push in the right direction would be great! I'm a bit at a loss. I really hope I explained myself properly!
Thank you so much!
Your answer
Follow this Question
Related Questions
Following the trail of Perlin Noise random movement? 1 Answer
Type out text in sync with audioclip 0 Answers
How do I do math in unity.(timer/60 and timer%60) 1 Answer
Quick Question 1 Answer