Rotating n/b, rotating spotlight

Discussion in 'Content Creation' started by AR162B, Mar 26, 2015.

  1. AR162B

    AR162B
    Expand Collapse

    Joined:
    Aug 11, 2013
    Messages:
    830
    Hey guys, I'm trying to make the classic police parts as realistic as possible. Now I've got a lightbar and with help of some lua rotating lights, but no rotating spotlights. Does anyone know if it's possible to have a rotating spotlight function, or a way to have a n/b structure rotating so the spotlight reference rotates.

    Thereby I would love to have wig-way lights, but like the lighbar, with real working spotlights. A bit like the blinker function but faster, and preferably also with the negative function (when the left light is on, the right is off and vice versa). Is there some way to make this possible? :)
     

    Attached Files:

    • screenshot_00221_1920.jpg
  2. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    It's doable


    Have a look at my latest version of the Crown Victoria. The Lightbar has rotating spotlights.
    It's in the "....additionalparts.jbeam". You just have to select different phase to alternate the lights (Phase of 1 means they are totally inverted, 0 means those are synced (if they have also the same Period).
    After them, you have to put another "option" section with the "normal values" (you will see in my files), or you will get all the lights in the vehicle to rotate..


    (imported from here)
     
    #2 Nadeox1, Mar 27, 2015
    Last edited by a moderator: Oct 21, 2015
  3. AR162B

    AR162B
    Expand Collapse

    Joined:
    Aug 11, 2013
    Messages:
    830
    Oh nice! Is that something you found out? Is it 'programmed' like a regular spotlight? (same three reference nodes e.g., spinning around the z-axis?)

    Thanks! :)
     
  4. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    I was searching for that on my own, and while looking through the lua files I found the correct way to invoke the animation thing ;)
    It works exactly like a normal spotlight, just that it is animated.
     
  5. AR162B

    AR162B
    Expand Collapse

    Joined:
    Aug 11, 2013
    Messages:
    830
    I finally got it working (after figuring out I already had a prop section in the jbeam and so this new prop section didn't work :p )

    But I've got some small issues;

    - I didn't find that 'option' section to disable the rotating part, so like you said, all other spotlights are rotating as well.

    - The spotlights are rotating in a direction and I can't figure out how to change this direction... I set the period to -1 the game crashes, if I mirror the reference nodes nothing changes... (also the basetranslation part seems to be different to the regular spotlights, it's hard to get the center of rotating in the right location)

    - The rotating speed seems to be isolated from the 'physics' speed? When pressing 'j' or slowing down the physics the rotating speed is unaffected.

    Could you please let me know how (if possible) to fix those issues? :D
     

    Attached Files:

    • screenshot_00235_1920.jpg
  6. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    I think the way I did it on my Vic was to put that as LAST slot, so they get loaded for last and will not affect the other lights.
    And yep, the speed of those are not synced with the physics engine speed yet..

    I think that to invert the rotation you have to rotate the spotlight up-side-down
     
  7. AR162B

    AR162B
    Expand Collapse

    Joined:
    Aug 11, 2013
    Messages:
    830
    Choosing another ref nodes made them turn the other way :D I was a bit confused with one axis.
    And, adding the line
    Code:
        "animationType":""
    ends the rotation animation. A shame the simulation is not synced yet, it seems even lag has influence. It's hard to have the spotlight function synced with the (lua based) rotating meshes.

    Do you know by any chance how to stop a lua based animation (the rotating meshes) when a deformationgroup or breakgroup is triggered?
     

    Attached Files:

    • screenshot_00240_1920.jpg
  8. chris_lucas

    chris_lucas
    Expand Collapse

    Joined:
    Dec 12, 2012
    Messages:
    1,444
    Make the lights a deform group and the damage texture should be a transparent image.
    Code:
             {"deformGroup":"moonhawk_windshield_break", "deformMaterialBase":"yourcoplighttexture", "deformMaterialDamaged":"yourinvisibletexture"}
             ["yourcoplightmesh", ["moonhawk_body"]],
     
    #8 chris_lucas, Mar 30, 2015
    Last edited: Mar 30, 2015
  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