Difference between revisions of "Streams"

Difference between revisions of "Streams"

From BeamNG
Line 1: Line 1:
 +
{{TOC_Right}}
 +
 
This page will contain a list of gui stream values, and some tips on how to use them.
 
This page will contain a list of gui stream values, and some tips on how to use them.
  
<source>
+
= wheelInfo=
Wheels:
+
This is an array of wheels, for each wheel:
array of wheels, each wheel:
+
* This is an array of wheels, for each wheel:
0  wd.name
+
**0  wd.name
1  wd.radius
+
**1  wd.radius
2  wd.wheelDir
+
**2  wd.wheelDir
3  w.angularVelocity
+
**3  w.angularVelocity
4  w.lastTorque
+
**4  w.lastTorque
5  drivetrain.wheelInfo[wd.wheelID].lastSlip
+
**5  drivetrain.wheelInfo[wd.wheelID].lastSlip
6  wd.lastTorqueMode
+
**6  wd.lastTorqueMode
  
engineInfo:
+
=engineInfo=
0  v.data.engine.idleRPM
+
This has stuff to do with the drivetrain and some general physics current values and settings.
1, v.data.engine.maxRPM
+
*0  v.data.engine.idleRPM
2, v.data.engine.shiftUpRPM
+
*1, v.data.engine.maxRPM
3, v.data.engine.shiftDownRPM
+
*2, v.data.engine.shiftUpRPM
4, drivetrain.rpm
+
*3, v.data.engine.shiftDownRPM
5, drivetrain.gear
+
*4, drivetrain.rpm
6, v.data.engine.fwdGearCount
+
*5, drivetrain.gear
7, v.data.engine.revGearCount
+
*6, v.data.engine.fwdGearCount
8, drivetrain.torque
+
*7, v.data.engine.revGearCount
9, drivetrain.torqueTransmission
+
*8, drivetrain.torque
10, obj:getVelocity():length()  -- airspeed
+
*9, drivetrain.torqueTransmission
11, drivetrain.fuel
+
*10, obj:getVelocity():length()  -- airspeed
12, drivetrain.fuelCapacity
+
*11, drivetrain.fuel
13, sensors
+
*12, drivetrain.fuelCapacity
14, Settings.gravity
+
*13, sensors
 +
*14, Settings.gravity
  
stats: [wip]
+
=stats=
  
electrics: [wip]
+
=electrics=
  
sensors: [wip]
+
=sensors=
  
torqueCurve: [wip]
+
=torqueCurve=
</source>
 
  
 +
=Using Streams=
 
In your app's update function, you can get the content of the streams as following:
 
In your app's update function, you can get the content of the streams as following:
 
<source>
 
<source>

Revision as of 17:03, 24 June 2014

This page will contain a list of gui stream values, and some tips on how to use them.

wheelInfo

This is an array of wheels, for each wheel:

  • This is an array of wheels, for each wheel:
    • 0 wd.name
    • 1 wd.radius
    • 2 wd.wheelDir
    • 3 w.angularVelocity
    • 4 w.lastTorque
    • 5 drivetrain.wheelInfo[wd.wheelID].lastSlip
    • 6 wd.lastTorqueMode

engineInfo

This has stuff to do with the drivetrain and some general physics current values and settings.

  • 0 v.data.engine.idleRPM
  • 1, v.data.engine.maxRPM
  • 2, v.data.engine.shiftUpRPM
  • 3, v.data.engine.shiftDownRPM
  • 4, drivetrain.rpm
  • 5, drivetrain.gear
  • 6, v.data.engine.fwdGearCount
  • 7, v.data.engine.revGearCount
  • 8, drivetrain.torque
  • 9, drivetrain.torqueTransmission
  • 10, obj:getVelocity():length() -- airspeed
  • 11, drivetrain.fuel
  • 12, drivetrain.fuelCapacity
  • 13, sensors
  • 14, Settings.gravity

stats

electrics

sensors

torqueCurve

Using Streams

In your app's update function, you can get the content of the streams as following:

MyApp.prototype.update = function(streams){
    streams.wheelInfo   //<- there's your wheelinfo
    streams.wheelInfo[0] // <- first wheel
    streams.wheelInfo[0][0] // <- name of the first wheel

    streams.sensors.position.x // <- x-Coordinate of the position of the current vehicle
}