1. Stuck, Having problems with creating your mod? Let us help you: Mod Support

Underbody lights using props and spotlights

Discussion in 'Programming' started by ItsJustCurtis, Jan 22, 2019.

  1. ItsJustCurtis

    ItsJustCurtis
    Expand Collapse

    Joined:
    Apr 10, 2017
    Messages:
    153
    So i'm trying to make underbody lights work as a proof of concept that I can later tune to my needs, however the props code seems to be somewhat unpredictable in its behaviour. Code below:

    Code:
    {
    "coupe_neon": {
        "information":{
            "authors":"ItsJustCurtis",
            "name":"Neons",
            "value":500,
        }
        "slotType" : "coupe_towhitch",
    "props": [
        ["func"      , "mesh"              , "idRef:", "idX:", "idY:"            , "baseRotation"        , "rotation"                 , "translation"        , "min", "max", "offset", "multiplier"]
        {
            "lightInnerAngle":0
            "lightOuterAngle":180
            "lightBrightness":1
            "lightRange":10
            "lightColor":{"r":255, "g":255, "b":255, "a":255}
            "lightAttenuation":{"x":0, "y":0, "z":0}
            "lightCastShadows":true
            "flareName":"vehicleHeadLightFlare"
            "flareScale":0.5
            //"cookieName":"vehicles/coupe/neons/coupe_neon.DDS"
            "texSize":512
            "shadowSoftness":0.5
        }
       
        ["running"    , "SPOTLIGHT"        , "rb5r", "rb5l", "fb4rr", {"x":180, "y":0, "z":0} , {"x":0, "y":0, "z":0}    , {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":0.35, "y":0.0, "z":0.05},"lightRange":180,"lightBrightness":1,"flareScale":0.1}], 
    
        ["running"    , "SPOTLIGHT"        , "rb5r", "rb5l", "fb4rr", {"x":180, "y":0, "z":0} , {"x":0, "y":0, "z":0}    , {"x":0, "y":0, "z":0}, 0, 0, 0, 1, {"baseTranslation":{"x":0.65, "y":0.0, "z":0.05},"lightRange":180,"lightBrightness":1,"flareScale":0.1}], 
    
    ],
    
    }
       
    }
    At present, this results in the below:



    I had it working briefly, with the .DDS file showing correctly in the reflection on the ground, but adding a second source caused this odd behaviour of a beam of light that follows the camera. At first I put that down to an all white .DDS, or the game failing to read the .DDS, however there are no errors in the console when previously it would tell me if it was unable to read it. I have re-created and resaved the .DDS so that file is definitely okay.

    I've tried reading the props and spotlight positioning wikis, however neither of them seem to go into detail on exactly what properties each argument changes, or any troubleshooting and how the game responds to certain coding errors, so I have no idea where to even start looking.
     
  2. FLyInG 2 YoUr SoUL

    FLyInG 2 YoUr SoUL
    Expand Collapse

    Joined:
    May 31, 2016
    Messages:
    4,602
    Make sure the reference nodes you chose for spotlight positioning are not moving themselves, otherwise the cross product of the vectors will move, in turn moving the light source.

    Also check orientation of the light source (baseRotation and translation).
     
  3. ItsJustCurtis

    ItsJustCurtis
    Expand Collapse

    Joined:
    Apr 10, 2017
    Messages:
    153
    The nodes I've used are at the corners of the car on the bumpers, however I have had it working no issue with those, even being able to rip off the bumpers and it just followed the bumper :p The rotation and translation values haven't changed either since the last time it was working so I'm not sure that is the issue either :/
     
  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