Announcement

Collapse
No announcement yet.

Speed Meter for car!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Here's the equation I use to calculate MPH, this may be different for you depending on the scale you use:

    Code:
    MPH = VSize(Velocity * vect(1,1,0)) * 0.044739;
    If you're talking about a needle, you'll need a StaticMeshComponent in the vehicle for it and a slightly more complicated equation to set its rotation every Tick. To give you an example, this is the code I run every frame to set my speed needle's rotation. This will be different for you depending on your StaticMeshComponent's initial rotation and the position of 0 and your max speed's rotation values:

    Code:
    NewRot.Yaw = 16384;
    NewRot.Pitch = 24030 - (400.5 * MPH);
    NewRot.Roll = 13289 + (abs(MPH - 60) * 5826 / 60);
    SpeedNeedle.SetRotation(NewRot);
    You may also want to add some damping for that value, I have other code that does that. The code as I posted it reacts instantly to changes in MPH which doesn't look good. That should be enough to get you started though.

    Leave a comment:


  • started a topic Speed Meter for car!

    Speed Meter for car!

    hi all
    how can i , make a Speed Meter for scorpion or another car?

    thanks
Working...
X