hey guys i’m trying to implement a ghost race into my project, I found something about it on youtube but i’m not so sure. Is there a way to replicate inputs on another actor? My vehicle is pysichs-based, do I need to set world transform or just apply force? My doubt is, pyshics and ‘set’ won’t work together, correct? Hope someone can help!!!
Maybe it’s enough to record the transforms:
vid: https://i.gyazo.com/7754b93603a20c20…9e73d33387.mp4
In the vid, the sliding car is the recorded ghost. R starts recording, P starts playing. You’ll want to work in some array bounds checks here obviously.
It’s probably not necessary to record the transform every frame, you could get away with 10 per second and interpolate to get the desired precision (this would also make it frame independent). Or record even less frequently if you get clever with splines.
I wouldn’t rely on input to re-simulate physics. This sounds like a world of pain.
looks cool the sliding car! wow dude thanks for these info I will try this solution?
@Everynone one last thing…how can record every 10 frame per second and interpolate? I only have one transform pin and don’t know what to interp!
An event timer running at .1 would record 10 times per second for example. Or, ideally, have a separate actor to do the recording, and have its tick run slower (it’s in the class defaults). You interpolate from the previous to the next point. You could use a timeline to play it back - this would also allow for setting the replay speed (if necessary) since you can control the rate at which it plays back.
You could even get cheeky and have the original racing car add spline points as you go; once the race is over, you do not even need to do anything - you already have the spline. Can’t recall if spline point rotation is exposed or not. [HR][/HR]Do note that what I suggested is barely a stub. You’d want record more data that just the car transform, surely: the wheels on the ghost car are not turning, for example, neither does an unhinged bumper wiggle (if any), perhaps the car hit a fence and you want to show that during the ghost run, too. A bunch of structs could hold all that data.
If all you want is a transform, than the above may just be enough. I’m just throwing ideas around, I’ve done something like this twice or so and it worked for what I needed. There might be better solutions. They are unlikely to be simpler, though.