• Create Account

# jujunosuke

Member Since 14 Jun 2010
Offline Last Active Oct 23 2013 12:53 AM

### In Topic: Replay Physics

11 September 2013 - 07:12 PM

Now that i know what to do, i just need to implement it on my project.

Thanks again.

### In Topic: Replay Physics

11 September 2013 - 04:08 AM

Sorry dude but i didn't came on gamedev physics forum to get someone who give me a link to a product.

I am here because i want to solve a problem and think with my head.

Otherwise i would have post on Unity forum don't you think so ?

Make sens ?

Sorry i don't want to sound rude.

### In Topic: Replay Physics

11 September 2013 - 03:39 AM

i think i got it.

I kind of replied my own answer.

So, here is the formula to interpolate two values or two Vector3

```//==================================================================
//  INTERPOLATE
//==================================================================
public float interpolate( float x1, float x2, float x3, float y1, float y3 ) {
return ( (x2 - x1) * (y3 - y1) / (x3 - x1) ) + y1;
}
```

x1 is the timing of the keyframe1

x2 is the current timing

x3 is the timing of the keyframe2

y1 is the recorded position of the keyframe1

y3 is the recorded position of the keyframe2

It will return y2 which is the interpolation of keyframe 1 and 2.

The position will change with the current timing

So basically, the interpolation can be done properly even if the framerate is not a fixed framerate

because the position can be calculated at any moment with the interpolation function.

Thats it, i hope it help.

### In Topic: Replay Physics

10 September 2013 - 08:03 PM

Instead of trying to replicate and reproduce the physics in my replay, i think i will go with the keyframe system as you mentioned.

It just looks to be so less pain..

I have more questions though, i hope you can help me to clear my mind.

If during the game, i record something like this :

0.0 ==> carPosition.x = 0;

1.0 ==> carPosition.x = 10;

2.0 ==> carPosition.x = 20;

Because my game has no fixed time step, the framerate is every-time different. So if during the replay my camera angle is different, with more objects displayed on screen, i will never be able to reproduce the action at the exact same timing i recorded them..

Instead of being 0.0, 1.0, and 2.0 seconds it will probably play 0.03, 1.023, 2.054 etc...

Does that mean that i need to calculate the position of my car related to these value ?

For example if at recorded time 1.0 my car position is 10, when replayed at 1.023 it should be :

positionX = 20(next position) - 10(actualPosition) = 10 * 1.023(currentTime) = 10.23

Is that pseudo code correct ?

What i want to say is that even if the replay time is totally different from the actual recorded time, i should be able to "guess" the position of the car with mathematic.

Am i correct ?

And the last question, how often would i have to record keyframes ?

The more i record them the more accurate the replay will be right ?

Anyway, thank you very much, and i hope you can understand my English because i am not native speaker..

Best regards.

### In Topic: [Car physics] Wheels / Tire Traction torque

01 July 2013 - 07:26 PM

I made a mistake its 350 Nm @ 3200 (BMW M3 E36)

Still very powerful

The fact is i was used to play with wrong torque feedback (forget to multiply by gear ratio), so my torque feedback was insanely strong.

And i made all the other car settings based on that setting.

So yesterday i tried to play a little bit with the "new" settings and by increasing the grip on the wheels, and tweaking the cylinder inertia formula, i get much more decent results now.

Also my Tachometer RPM needle feel really smooth hehe.