Jump to content

  • Log In with Google      Sign In   
  • Create Account


jujunosuke

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

Topics I've Started

Replay Physics

10 September 2013 - 12:01 AM

Hi everyone,

 

I would like to get some advice on how to make a visually convincing replay for my racing game.

 

I am using PhysX for the physics simulation and i am pretty sure that everything is non-deterministic.

I am not sure how to verify if my time step is fixed or not ?

 

My first attempt at recording replay was very hilarious, and a big fail to say the least...

 

I tried to record user input (only input change) so every time i want to start recording i have a variable called recordedTime.

This variable is incremented with the time step like this.

if (isRecording) {

     recordedTime += Time.timeStep;

}

Then i would record the user input like this

void recordAction( float time, string actionName ) {
     actions.Add( time.ToString() + "_" + actionName );
}

so for example recordAction( recordedTime, "accel_on" );

etc etc.

 

But of course failed to reproduce the action properly.

So i decided to add some keyframes at key moments in order to repositionate the car in the good position direction velocity and everything.

 

 

So i have a function that record pretty much everything.

Car position, orientation, rigidbody velocity, rigidbody angularvelocity, same for wheels, etc...

 

But even after adding the keyframe system, it just does not worked as expected.

 

The thing, is i don't know really the tweaking i need to do in order to reproduce the same action at the same time.

Should i use Update ? FixedUpdate ? LateUpdate ? to record action ?

 

I just struggle to understand the most fundamental concept.

If i record acceleration input at 1.20 second, how can i play it again later with a different camera angle that is going to affect my framerate and then play the action faster or slower than 1.20 ?

 

 

So, instead of trying to reproduce everything in a physical way, i was wondering if it would be a decent solution to record the car position and orientation keyframes only, and then play a kind of linear transition between each keyframes in order to reproduce visually the movement of my car.

What would you think about this option ?

Does some professional games use it ?

 

Any feedback or advices would be very appreciated.

Thank you in advance.


[Car physics] Wheels / Tire Traction torque

30 June 2013 - 08:02 PM

Hi everyone,

 

I am not sure how i should calculate the traction torque that act as a brake/resistance on the engine.

 

For example, the real wheels of my car spins, and lets say that each wheels return 3000 Nm of Force.

I am pretty sure that to transform that force in torque i need to multiply the returned force by the wheel radius right ?

 

 

So, for a rear wheel drive car for example, the Traction Torque that act as a Brake on the engine would be

3000 Nm * wheel radius + 3000 Nm * wheel radius = traction torque of both rear wheels ?

Right now, i am doing 6000 Nm * wheel radius.

 

 

I am a little bit confuse.

At the moment, my car traction torque is very huge and my car acceleration feel quite slow.

The car doesn't rev very well.

 

Any feedback would be greatly appreciated.

 

Best regards.


[Car Physics] - Angular Velocity / Angular Momentum

23 September 2012 - 08:04 PM

Hi everyone,

I actually use a physics engine for my racing game (physX) with a some rigid bodies.
Basically, i have 4 wheels that have a rigidbody on it and these wheels are connected to the body of the car via a spring.

I use Pacejka typical curves to simulate the tire model.
I have no problem so far regarding the basic move of the car, it work pretty well i would say.

But recently, i have played some nice racing game simulation and some car crash videos on youtube and noticed that something important was missing to my car simulation.

The Angular Velocity / Momentum !

In fact, my car behavior act like there is no angular momentum at all.. I mean, the weight of the car doesn't feel right..

For example, if i turn on the right at medium speed, and then counter steer, my car will NOT spin and loose control, the angular speed is immediately stopped..

But i don't think its like my car have too much lateral grip, its something different i think...

Something must be wrong on my rigid body settings..

My 4 wheels rigid body are about 40 kg each, and the car body is around 1400 kg.
I have tested with more weight on wheels and less on car body but, it doesn't fix the problem, actually its getting a little bit worst.
The best results i have so far is around 30 - 50 kg for each wheels.

Do you guys have any suggestions on this ?
How can i have a stronger angular velocity ?

i would like my car to spin!

Any suggestions are very welcome.
Thank you for reading.
Please forgive my bad English.

[Car Physics] - Front wheels slipRatio calculation

21 June 2012 - 02:18 AM

Hi everyone !

In my car simulation i have some problems with the calculation of the front wheels slip Ratio.
My car is a RWD.

Basically, my calculation are the same as the rear wheels :
I use (wheel local Vel Z / wheelAngularVelocity).
This work very nice, and the friction generated by the slip, became the traction force that make the wheels turn.

The problem happen when i start to turn the front wheels.
The difference beetween the wheelAngularVelocity and the ground velocity became stronger, and the result is the front wheels longitudinal Force became very high !

This act as a kind of break or sometimes it reduce the steering ability of my car drastically.

For the moment the hack i found was to apply the front wheels longitudinal Force only when i brake...
This hack work quite well but unfortunately it create some other issues in some different situations..


I have a question :
For a RWD car, when i am not braking the front wheels should be rolling all the time right ? So the returned longitudinal force from this wheel should be 0 all the time ?


I know it is a very specific question but i hope i can get some input about this.
Thank you in advance for any help.

Best Regards.

[Car Physics] - Wheels rotation with traction force

16 May 2012 - 08:05 PM

Hi everyone !

In my current racing simulation, for a RWD car, the front wheels rotation speed is calculated with the local z velocity of the car.
This work well from now, but my simulation is getting more complex now, and i was wondering if calculating the front wheels rotation with the ground friction was a good idea ?

For example, rear wheels acceleration push the car forward and move the car.
Then, i would accelerate the front wheels with the traction force (frontWheelsAngularVelocity vs ground speed).

Is this a good approach to calculate the wheels that are not linked with the drive train ?

I know that this is a very specific question but, any feedback or discussion about this is welcome.

Thank you in advance.
Best regards !

PARTNERS