GetElementDistanceFromCentreOfMassToBaseOfModel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(As the function is a client function, changed →‎See also: to client element functions)
(Added pre-caclulated outputs for this function.)
Line 16: Line 16:
local distance = getElementDistanceFromCentreOfMassToBaseOfModel(localPlayer)
local distance = getElementDistanceFromCentreOfMassToBaseOfModel(localPlayer)
outputChatBox(tostring(distance))
outputChatBox(tostring(distance))
</syntaxhighlight>
==Pre-calculated Outputs==
This is a list of GTA:SA's vehicle ID numbers matched with their output from this function
Lua table of all the valid vehicle IDs with their outputs listed on this page:
<syntaxhighlight lang="lua">distanceFromCenterOfMassToBaseOfModelTable = {602 = 0.90000009536743, 545 = 0.94999980926514, 496 = 0.78772735595703, 517 = 0.93566590547562, 401 = 0.86781454086304, 410 = 0.74999296665192,
518 = 0.79480773210526, 600 = 0.84184813499451, 527 = 0.78314852714539, 436 = 0.87799340486526, 589 = 0.71692597866058, 580 = 0.90752363204956,
419 = 0.92999982833862, 439 = 1, 533 = 0.79999989271164, 549 = 0.86147683858871, 526 = 0.84999984502792, 491 = 0.8999999165535,
474 = 0.89999985694885, 445 = 0.98999989032745, 467 = 0.87000000476837, 604 = 0.91999995708466, 426 = 0.81999969482422, 507 = 0.95000004768372,
547 = 0.83999991416931, 585 = 0.69692599773407, 405 = 1, 587 = 0.81000000238419, 409 = 0.92499983310699, 466 = 0.91999995708466,
550 = 0.92278164625168, 492 = 0.89999997615814, 566 = 0.90000021457672, 546 = 0.84184813499451, 540 = 0.97950112819672, 551 = 0.87999987602234,
421 = 1, 516 = 0.89999997615814, 529 = 0.73788851499557, 592 = 2.2973258495331, 553 = 3.2349998950958, 577 = 1.0746998786926,
488 = 1.2650001049042, 511 = 2.5158977508545, 497 = 1.2650001049042, 548 = 2.9000618457794, 563 = 1.8857498168945, 512 = 1.6340000629425,
476 = 2.1701526641846, 593 = 1.5501824617386, 447 = 1.1000000238419, 425 = 1.8510003089905, 519 = 2, 520 = 1.9195756912231,
460 = 2.219527721405, 417 = 1.2730000019073, 469 = 1.1000000238419, 487 = 1.2650001049042, 513 = 1.78475689888, 581 = 0.69976079463959,
510 = 0.69584167003632, 509 = 0.5997970700264, 522 = 0.66037738323212, 481 = 0.60877603292465, 461 = 0.67450165748596, 462 = 0.67021918296814,
448 = 0.67021918296814, 521 = 0.66037738323212, 468 = 0.75999987125397, 463 = 0.61699998378754, 586 = 0.59700000286102, 472 = 0.77418208122253,
473 = 0.32354342937469, 493 = 1.3853187561035, 595 = 1.102756023407, 484 = 1.3414800167084, 430 = 0.79800415039063, 453 = 0.93193912506104,
452 = 0.58204936981201, 446 = 1.0186829566956, 454 = 1.2658512592316, 485 = 0.69999998807907, 552 = 0.77690804004669, 431 = 1.25,
438 = 1.1999999284744, 437 = 1.25, 574 = 0.79393339157104, 420 = 0.84999972581863, 525 = 0.99000000953674, 408 = 1.75, 416 = 1.2995755672455,
596 = 0.81999969482422, 433 = 1.5699999332428, 597 = 0.8699996471405, 427 = 1.2480000257492, 599 = 1.3851264715195, 490 = 1.3201265335083,
432 = 1.0993369817734, 528 = 1.1849999427795, 601 = 0.93020880222321, 407 = 1.3700000047684, 428 = 1.2497900724411, 544 = 1.3700000047684,
523 = 0.66037738323212, 470 = 1.1100116968155, 598 = 0.8699996471405, 499 = 1.0999999046326, 588 = 1.1393926143646, 609 = 1.210000038147,
403 = 1.700000166893, 498 = 1.210000038147, 514 = 1.6996750831604, 524 = 2.0531990528107, 423 = 1.1302119493484, 532 = 2.1097192764282,
414 = 1.1500000953674, 578 = 1.75, 443 = 1.750394821167, 486 = 1.3000000715256, 515 = 2.1537208557129, 406 = 1.7513251304626,
531 = 1.0064532756805, 573 = 1.215448141098, 456 = 1.25, 455 = 1.5699999332428, 459 = 1.1399999856949, 543 = 0.94999998807907,
422 = 1.0799999237061, 583 = 0.64689421653748, 482 = 1.25, 478 = 1.0799999237061, 605 = 0.94999998807907, 554 = 1.1949999332428,
530 = 0.80008584260941, 418 = 1.1829564571381, 572 = 0.63999998569489, 582 = 1.1549999713898, 413 = 1.1499999761581, 440 = 1.2126893997192,
536 = 0.85000014305115, 575 = 0.7399999499321, 534 = 0.8228771686554, 567 = 0.97834157943726, 535 = 0.8400000333786, 576 = 0.75,
412 = 0.94999992847443, 402 = 0.93999981880188, 542 = 0.84339809417725, 603 = 1.0026750564575, 475 = 0.8999999165535, 449 = 2.4973087310791,
537 = 2.5995426177979, 538 = 2.4756197929382, 441 = 0.17500001192093, 464 = 0.40700000524521, 501 = 0.4549999833107, 465 = 0.4549999833107,
564 = 0.23500001430511, 568 = 0.97500002384186, 557 = 0.3917441368103, 424 = 0.84722626209259, 471 = 0.57500004768372, 504 = 0.93999993801117,
495 = 1.5600740909576, 457 = 0.7293484210968, 539 = 0.65000009536743, 483 = 1.0955964326859, 508 = 1.4499998092651, 571 = 0.33228185772896,
500 = 1.2200000286102, 444 = 0.3917441368103, 556 = 0.3917441368103, 429 = 0.75, 411 = 0.79999983310699, 541 = 0.69999998807907,
559 = 0.75406360626221, 415 = 0.84952139854431, 561 = 0.92399996519089, 480 = 0.85000002384186, 560 = 0.80497515201569, 562 = 0.75354951620102,
506 = 0.79211330413818, 565 = 0.6919310092926, 451 = 0.76437205076218, 434 = 1.1492453813553, 558 = 0.70379173755646, 494 = 0.97000002861023,
555 = 0.78037416934967, 502 = 0.9694904088974, 477 = 0.85000002384186, 503 = 0.9694904088974, 579 = 1.098637342453, 400 = 1.136110663414,
404 = 0.8299999833107, 489 = 1.3601264953613, 505 = 1.3601264953613, 479 = 0.90458089113235, 442 = 0.94986796379089, 458 = 0.97020995616913,
606 = 1.0937063694, 607 = 1.0999999046326, 610 = 0.4003584086895, 590 = 2.5152010917664, 569 = 2.5144035816193, 611 = 0.69189035892487,
584 = 2.1593854427338, 608 = 1.5730134248734, 435 = 1.6541831493378, 450 = 1.6541831493378, 591 = 1.6541831493378, 594 = 0.20966726541519}
</syntaxhighlight>
</syntaxhighlight>
==See Also==
==See Also==
{{Client element functions}}
{{Client element functions}}

Revision as of 06:21, 2 January 2012

This function is used to retrieve the distance between a element's centre of mass to the base of the model. This can be used to calculate the position the element has to be set to, to have it on ground level.

Syntax

float getElementDistanceFromCentreOfMassToBaseOfModel ( element theElement )

Required Parameters

theElement: The element you want to retrieve the value of.

Returns

Returns a float with the distance, or false if the element is invalid.

Example

This example outputs the value for the local player.

local localPlayer = getLocalPlayer()
local distance = getElementDistanceFromCentreOfMassToBaseOfModel(localPlayer)
outputChatBox(tostring(distance))

Pre-calculated Outputs

This is a list of GTA:SA's vehicle ID numbers matched with their output from this function

Lua table of all the valid vehicle IDs with their outputs listed on this page:

distanceFromCenterOfMassToBaseOfModelTable = {602 = 0.90000009536743, 545 = 0.94999980926514, 496 = 0.78772735595703, 517 = 0.93566590547562, 401 = 0.86781454086304, 410 = 0.74999296665192, 
518 = 0.79480773210526, 600 = 0.84184813499451, 527 = 0.78314852714539, 436 = 0.87799340486526, 589 = 0.71692597866058, 580 = 0.90752363204956, 
419 = 0.92999982833862, 439 = 1, 533 = 0.79999989271164, 549 = 0.86147683858871, 526 = 0.84999984502792, 491 = 0.8999999165535, 
474 = 0.89999985694885, 445 = 0.98999989032745, 467 = 0.87000000476837, 604 = 0.91999995708466, 426 = 0.81999969482422, 507 = 0.95000004768372, 
547 = 0.83999991416931, 585 = 0.69692599773407, 405 = 1, 587 = 0.81000000238419, 409 = 0.92499983310699, 466 = 0.91999995708466, 
550 = 0.92278164625168, 492 = 0.89999997615814, 566 = 0.90000021457672, 546 = 0.84184813499451, 540 = 0.97950112819672, 551 = 0.87999987602234, 
421 = 1, 516 = 0.89999997615814, 529 = 0.73788851499557, 592 = 2.2973258495331, 553 = 3.2349998950958, 577 = 1.0746998786926, 
488 = 1.2650001049042, 511 = 2.5158977508545, 497 = 1.2650001049042, 548 = 2.9000618457794, 563 = 1.8857498168945, 512 = 1.6340000629425, 
476 = 2.1701526641846, 593 = 1.5501824617386, 447 = 1.1000000238419, 425 = 1.8510003089905, 519 = 2, 520 = 1.9195756912231, 
460 = 2.219527721405, 417 = 1.2730000019073, 469 = 1.1000000238419, 487 = 1.2650001049042, 513 = 1.78475689888, 581 = 0.69976079463959, 
510 = 0.69584167003632, 509 = 0.5997970700264, 522 = 0.66037738323212, 481 = 0.60877603292465, 461 = 0.67450165748596, 462 = 0.67021918296814, 
448 = 0.67021918296814, 521 = 0.66037738323212, 468 = 0.75999987125397, 463 = 0.61699998378754, 586 = 0.59700000286102, 472 = 0.77418208122253, 
473 = 0.32354342937469, 493 = 1.3853187561035, 595 = 1.102756023407, 484 = 1.3414800167084, 430 = 0.79800415039063, 453 = 0.93193912506104, 
452 = 0.58204936981201, 446 = 1.0186829566956, 454 = 1.2658512592316, 485 = 0.69999998807907, 552 = 0.77690804004669, 431 = 1.25, 
438 = 1.1999999284744, 437 = 1.25, 574 = 0.79393339157104, 420 = 0.84999972581863, 525 = 0.99000000953674, 408 = 1.75, 416 = 1.2995755672455, 
596 = 0.81999969482422, 433 = 1.5699999332428, 597 = 0.8699996471405, 427 = 1.2480000257492, 599 = 1.3851264715195, 490 = 1.3201265335083, 
432 = 1.0993369817734, 528 = 1.1849999427795, 601 = 0.93020880222321, 407 = 1.3700000047684, 428 = 1.2497900724411, 544 = 1.3700000047684, 
523 = 0.66037738323212, 470 = 1.1100116968155, 598 = 0.8699996471405, 499 = 1.0999999046326, 588 = 1.1393926143646, 609 = 1.210000038147, 
403 = 1.700000166893, 498 = 1.210000038147, 514 = 1.6996750831604, 524 = 2.0531990528107, 423 = 1.1302119493484, 532 = 2.1097192764282, 
414 = 1.1500000953674, 578 = 1.75, 443 = 1.750394821167, 486 = 1.3000000715256, 515 = 2.1537208557129, 406 = 1.7513251304626, 
531 = 1.0064532756805, 573 = 1.215448141098, 456 = 1.25, 455 = 1.5699999332428, 459 = 1.1399999856949, 543 = 0.94999998807907, 
422 = 1.0799999237061, 583 = 0.64689421653748, 482 = 1.25, 478 = 1.0799999237061, 605 = 0.94999998807907, 554 = 1.1949999332428, 
530 = 0.80008584260941, 418 = 1.1829564571381, 572 = 0.63999998569489, 582 = 1.1549999713898, 413 = 1.1499999761581, 440 = 1.2126893997192, 
536 = 0.85000014305115, 575 = 0.7399999499321, 534 = 0.8228771686554, 567 = 0.97834157943726, 535 = 0.8400000333786, 576 = 0.75, 
412 = 0.94999992847443, 402 = 0.93999981880188, 542 = 0.84339809417725, 603 = 1.0026750564575, 475 = 0.8999999165535, 449 = 2.4973087310791, 
537 = 2.5995426177979, 538 = 2.4756197929382, 441 = 0.17500001192093, 464 = 0.40700000524521, 501 = 0.4549999833107, 465 = 0.4549999833107, 
564 = 0.23500001430511, 568 = 0.97500002384186, 557 = 0.3917441368103, 424 = 0.84722626209259, 471 = 0.57500004768372, 504 = 0.93999993801117, 
495 = 1.5600740909576, 457 = 0.7293484210968, 539 = 0.65000009536743, 483 = 1.0955964326859, 508 = 1.4499998092651, 571 = 0.33228185772896, 
500 = 1.2200000286102, 444 = 0.3917441368103, 556 = 0.3917441368103, 429 = 0.75, 411 = 0.79999983310699, 541 = 0.69999998807907, 
559 = 0.75406360626221, 415 = 0.84952139854431, 561 = 0.92399996519089, 480 = 0.85000002384186, 560 = 0.80497515201569, 562 = 0.75354951620102, 
506 = 0.79211330413818, 565 = 0.6919310092926, 451 = 0.76437205076218, 434 = 1.1492453813553, 558 = 0.70379173755646, 494 = 0.97000002861023, 
555 = 0.78037416934967, 502 = 0.9694904088974, 477 = 0.85000002384186, 503 = 0.9694904088974, 579 = 1.098637342453, 400 = 1.136110663414, 
404 = 0.8299999833107, 489 = 1.3601264953613, 505 = 1.3601264953613, 479 = 0.90458089113235, 442 = 0.94986796379089, 458 = 0.97020995616913, 
606 = 1.0937063694, 607 = 1.0999999046326, 610 = 0.4003584086895, 590 = 2.5152010917664, 569 = 2.5144035816193, 611 = 0.69189035892487, 
584 = 2.1593854427338, 608 = 1.5730134248734, 435 = 1.6541831493378, 450 = 1.6541831493378, 591 = 1.6541831493378, 594 = 0.20966726541519}

See Also