Unsolved finding "get" and "set" lua terms

Discussion in 'Mod Support' started by fillman86, Mar 2, 2025.

  1. fillman86

    fillman86
    Expand Collapse

    Joined:
    Apr 18, 2020
    Messages:
    183
    I find myself doing a lot of lua modding, and I keep thinking of new things I could do, but a lot of it would be easier if I could figure out all the "obj:get" and "obj:set" lua commands like "getNodePositionRelativeXYZ"
    I don't understand how they're made, if they're made by the devs at all, or just something inherent to lua maybe?

    If there's a list somewhere, please link me, or instruct me how to find them. Otherwise I'm going to start listing some I've found, and I'll add yours to the list too.


    Vlua (vehicle lua);
    getNodePositionRelativeXYZ - vec3 values for node
    getNodeForceVectorXYZ - not sure
    getNodeVelocityVector - not sure
    getNodeMass - gets the mass of the node (not sure if newtons, or kg)
    setNodeMass - cid then value
    getBeamLength - gets the beam length in metres
    setBeamLength - cid, then length you want in metres
    setBeamLengthRefRatio - this seems to set the ratio from the spawn length, not from current length
    breakBeam - breaks the beam, great for pausing the game, breaking so you can find its location
    getDirectionVector - not sure, seems to work with nodeVecPlanarCos
    getDirectionVectorUp - not sure, seems to work with nodeVecPlanarCos
    setNodeFrictionSlidingCoefs(cid, 1, 1) - one value is slidingCoef, the other is frictionCoef for tyres. Default can be found on individual tyres, but usually it's '1' (no 'get' version)
    setAdd - not sure, I think it makes a vec3 relative to another vec3, or position of a node



    currently I'm only using things I've used myself, even if I didn't understand them. This list will get very long, very quickly though, so I'll take suggestions on how to format this if you'd like? Maybe I should make a google doc that people can add to, but I'm afraid of trolls from messing with/deleting stuff, solutions? There's different options than 'obj' too, and then it gets way different with game engine lua "gelua" (I think).
     
    • Like Like x 1
  2. Komodor

    Komodor
    Expand Collapse

    Joined:
    Dec 16, 2017
    Messages:
    12
    Good idea.

    I've already used your post. Thanks, I've been looking for this for a long time :)
    setNodeFrictionSlidingCoefs

    I don't know how to organize it. Maybe expanding on your post.
    Divide into GE, Vehicle etc. sections.


    From me, to keep this topic going.
    This is rather well-known.

    getGroundSpeed() - car speed ( obj:getGroundSpeed() )
    setGravity() - gravity for the car ( obj:setGravity(-20) )
    getRollPitchYaw() - roll, pitch, yaw ( local car_roll,car_pitch,car_yaw = obj:getRollPitchYaw() )

    There's also one, but it's more difficult to use:
    obj:addParticleByNodes() - adds particles
    obj:applyForce() - applies force.

    For example:
    obj:addParticleByNodes(k,0, 0 , 8, 0, 1)
    obj:applyForce(k, 0, 15000+((GroundSpeed * 20000)*math.random(10)))

    I add a particle of smoke I think and apply a force depending on the speed of the car.


    I will also add how to check if the car is a player or AI.

    playerInfo.anyPlayerSeated - returns: whether the player is TRUE or AI FALSE


    I use Google Translator. If I wrote something funny, I apologize :)
     
  3. fillman86

    fillman86
    Expand Collapse

    Joined:
    Apr 18, 2020
    Messages:
    183
    thanks for adding, I recently came across this too https://angelo234.github.io/List-of-BeamNG-Functions-And-Fields/ it has so much info on beamng lua code like this. I'm struggling to fully utilise it though, but it does add a lot of context on how to use code

    at the top of the page you can toggle between vehicle and game engine lua pages
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice