Not signed in (Sign In)

Discussion Tag Cloud

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorKingRCT3
    • CommentTimeFeb 18th 2016
     
    All questions, concerns and hopefully answers concerning scripts on NoLimits 2 belong here.

    Remember, when posting a script, please use the <code></code> tags.
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 18th 2016 edited
     
    @Bestdani:

    I have now created a smaller version of the scripts, but the result is the same:

    console result:

    _CoasterScript: true
    (onInit) closestCoaster: Coaster Cars


    Press H for Quick Help
    _CoasterScript: false
    (onNextFrame) closestCoaster: null
    (onNextFrame) MAIN: 0x9f

    It does detect, if a coaster or a SCO is the parent entity.
    But it forgets the coaster entity, afterall.

    And to make it simple, i didn't even use an array.
    Was this even, what you suggested?



    public static SceneObject MAIN;
    public static Coaster attachedCoaster;

    public static bool _singleActivation = true;
    public static bool _CoasterScript = true;

    public bool onInit(){
    MAIN = NoLimits.getSimulator().getSceneObjectForEntityId(getParentEntityId());
    if(MAIN!=null){
    _CoasterScript = false;
    }
    attachedCoaster = sim.getCoasterForEntityId(getParentEntityId());
    if(attachedCoaster!=null){
    System.out.println("_CoasterScript: "+_CoasterScript);
    System.out.println("(onInit) attachedCoaster: "+attachedCoaster+"\n\n");
    _CoasterScript = true;
    }
    return true;
    }

    public void onNextFrame(float tick){
    if(_singleActivation==true && _CoasterScript==false){
    _singleActivation = false;
    System.out.println("_CoasterScript: "+_CoasterScript);
    System.out.println("(onNextFrame) attachedCoaster: "+attachedCoaster);
    System.out.println("(onNextFrame) MAIN: "+MAIN+"\n\n");

    }


    Edit.
    Finally a dedicated scripting thread!

    And i didnt even had to post my API with around 10.000 lines of code (:
  1.  
    Is there a way someone could make a tutorial of starting from scratch and making a script and then applying it to a coaster.

    I've been trying to teach myself and haven't had much luck. If someone could make a super simple script just for education purposes that would be great.

    Thanks
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 18th 2016 edited
     
    ^
    it depends on what the script should do.

    Save it into your park-folder as "myCoasterScript.nlvm"


    import com.nolimitscoaster.*; //<-- this import is needed for every script. It contains all the SCO,Coaster,Track... functions/methods

    public class myCoasterScript extends Script{ //<-- Classname and File name must be the same: "public class myCoasterScript" -> myCoasterScript.nlvm

    public static Coaster attachedCoaster; // <-- attachedCoaster is a var from type: "Coaster".
    public static String myText = "Hello"; // <-- myText is a var from type: "String ".

    public bool onInit(){ //<-- this part will initialize all scripts. It only runs 1 time.
    // You want to fill all the vars in this part

    attachedCoaster = sim.getCoasterForEntityId(getParentEntityId()); //<-- this will fill the var with a value. The value is the coaster, which has this script attached to.
    // (coaster properties -> script TAB)

    if(attachedCoaster!=null){ //<-- IF-statement is something like a 2-way-switch (the basic ones without elseif)
    //<-- It checks, if "attachedCoaster" is filled with a value and then
    System.out.println("(onInit) attachedCoaster: "+attachedCoaster+"\n\n"); //<-- returns a text-message in the console.
    System.out.println("Maximum Trains: "+attachedCoaster.getTrainCount()); //<-- the "getTrainCount()"-method returns the total train count of your coaster
    }

    /*
    This block comment allowes you to
    write longer comments. Those comments will be ignored by the script engine


    remember to write: "return true" at the end of the OnInit() part
    */

    return true;
    }

    public void onNextFrame(float tick){
    /*
    This is the framelistener.
    all of your vars get modified here.
    For example: moving an SCO to the position of the coaster on each rendered frame.
    */
    }
    }


    After saveing go to:
    Coaster properties -> Script -> add file -> [add your script]

    Save and start the Sim.


    Something like this?
    • CommentAuthorole
    • CommentTimeFeb 18th 2016 edited
     
    Right now coaster scripts and scene object scripts are running in different virtual machines. There is a technical reason for this, it is quite hard to explain. Anyway, I see that this conflicts with the idea of shared virtual machines. I might fix that in upcoming updates.

    Theoretically it is possible to have shared variables across multiple classes, but if you have a static variable in two classes, like you had in your original post, there will be two variables (and also two instances when each is assigned using a different new). If you only want to have one single variable, you need to only specify it in one class and when you try to access it from the other class, you need to specific the full name of the variable including its class name.

    E.g.:


    public class A
    {
    public static Vector vec;
    }

    ...

    public class B
    {
    public static Vector vec;
    }



    There are two variables vec, one is inside class A, one is inside class B...


    public class C
    {
    ...

    pulic bool onInit()
    {
    ....
    // this will access the vec in class A...
    A.vec

    // this will access the vec in class B...
    B.vec

    ....
    }

    }
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 18th 2016 edited
     
    ^
    Its just a bit confusing.
    Older scripts for attaching SCOs to Coasters are still working, so its not very critical.

    Just my "Visitors" are on hold again :s
    But with each update, im getting closer and closer to the release.

    Edit:
    can this single object have multiple instances?
    Or do you mean: only one instance?
    • CommentAuthorole
    • CommentTimeFeb 18th 2016
     
    with "object" I mean the same thing as "instance". Will fix my original post for clarification.
    • CommentAuthorMrRC
    • CommentTimeFeb 18th 2016
     
    Is it possible to attach an object to an TransferTable ? (to replace the excisting track style with a Fake piece of track)

    Kind regards,

    MrRC (Sjaak van Horne, Netherlands)
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 19th 2016
     
    ^
    Not directly.

    Maybe it works, when you have a fake-Transfer Table (wireframe) with a train on it.
    Then you can attach the Track to the train.

    And each time, the real transfer table moves, your fake transfer table moves as well.
    • CommentAuthorMrRC
    • CommentTimeFeb 19th 2016
     
    Yes i´m aware of the that, so i have to attach it to the train when its on the TransferTabel and Detach as it leaves.

    The only problem is, its an Shuttle coaster. I might ran into some problem(s)........
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 19th 2016 edited
     
    You can also attach an object to the rail of the transfertable with TrackPos.getCenterRailsMatrix() for example and update the position on each frame for these objects. It just requires that you can set the rail to "invisible" on a transfer table but I think that's also possible.
    • CommentAuthorMrRC
    • CommentTimeFeb 19th 2016
     
    @bestdani

    R u sure even on an TransferTable ?
    I never seen a picture of a RMC piece of track on an TransferTable .....
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 19th 2016 edited
     
    ^^
    Wow. It actually works. :/


    //Attach this script to a SceneObject.
    // file name: transfer.nlvm

    import com.nolimitscoaster.*;
    public class transfer extends Script{

    public static TrackPos myTrackPos;
    public static SceneObject mainSco;

    public bool onInit(){
    mainSco = sim.getSceneObjectForEntityId(getParentEntityId());
    myTrackPos = sim.findNearestCoasterTrack(mainSco.getTranslation(), 20.0f);
    System.out.println(myTrackPos.getCoaster());

    return true;
    }


    public void onNextFrame(float tick){
    System.out.println(myTrackPos.getCenterRailsMatrix());
    mainSco.setMatrix(myTrackPos.getCenterRailsMatrix());
    }
    }


    When a SCO (like the custom rails) is placed near the transfer table, it should connect to it.
    • CommentAuthorMrRC
    • CommentTimeFeb 19th 2016 edited
     
    @Fuchschen,

    I see the object (custom rail object) changing to another location near the support of the TransferTable, but it doesn't move with the TransferTable.

    EDIT :

    YES i got it working, the object has to be in the center of the 3 AXES of your 3d program.
  2.  
    Is C# (script language) something near/like scripting in nl2?

    I know I've not done much in nl2 lately... Because I am learning to script :)
  3.  
    I'd say java is closer
  4.  
    ^...the only difference is bool haha
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 24th 2016 edited
     
    I don't know C# but it is mentioned in the manual as a language that is near to the NLVM language and from looking at some C# examples it seems to be very similar except for some keywords that differ.
  5.  
    Thanks!
  6.  
    This might be an odd question, but does anyone know of a good place and/or source to learn Java?
  7.  
    ^ I got taught using this at Kent Uni:
    http://www.bluej.org
    Its a pretty good IDE, not as feature full as something like Eclipse but it is designed for beginners. It colour codes stuff automatically so you can easily see when you have not formatted code correctly etc which is very useful.
    Also on the website is a link to the book. It its a pretty decent book but its really expensive, its written by the lecturer and so its obvious that he tries to push his own work haha. I have the PDF file of it though so if you want I could email it to you?
    •  
      CommentAuthorSedjuuurd
    • CommentTimeFeb 27th 2016
     
    uhm can someone help me. i need a script to make a triggered event. so like a invisible block that triggers a sound effect when you walk trough it.

    if this is easily done could someone make it for me? i need it so much :C
    and i am not able to script myself...
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 28th 2016 edited
     
    ^ Try this, it's a quick (and not yet tested) modification of my view triggered keyframe animation, so that an object plays a sound instead of an animation: Download.
    •  
      CommentAuthorSedjuuurd
    • CommentTimeFeb 28th 2016
     
    thanks bestdani. im going to test it but for now it looks alright. ill let you know if i may run into problems
    • CommentAuthorjonny9403
    • CommentTimeFeb 28th 2016
     
    does anyone know how i'd make a scrobe light effect for a queue or a walkthorugh ?
    • CommentAuthoriHack97
    • CommentTimeFeb 29th 2016
     
    Hey, did someome know how to use the "setTextureAnimationFrameIndex" method from the last update ? ( 2.2.3.5)
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 29th 2016
     
    ^ Yep.

    ^^ Several ways exist, you might want to have a look at this or this.
    •  
      CommentAuthorbestdani
    • CommentTimeMar 1st 2016 edited
     
    Are there some general advice what could be done / avoided to improve the performance of scripts?

    I'm experiencing some heavy script caused performance slowdowns with a script for particles and therfore I'll try to figure out parts that slow down the script and I hope that I can improve things by transforming the "nice" code into "ugly" but maybe faster code.

    But I wanted to ask if someone has already figured out / knows what definitley has to be avoided, I'm looking for stuff like maybe: use own mathematic functions for floats instead of the inbuilt that use doubles(?), avoiding typecasting(?), avoid using objects / classes at all(?).
    • CommentAuthorole
    • CommentTimeMar 1st 2016 edited
     
    ^ Here is an important advice: Try to avoid too many "new" calls. While the "new" call itself is quite fast, creating lots of objects may cause the garbage collector to kick in which is very slow. A couple of new calls each frame are not that bad, but if you have like 500 particles and each particle will call "new" a couple of times in its update method, you can easily generate a couple of thousand objects each onNextFrame. For some API calls that require objects for parameters such as Vector3f/Vector4f/Matrix4x4f, try to reuse tempoary objects instead of creating a new one for each API call.

    I do not think it is worth to optimize any kind of math functions. Those are quite fast. In general, method calls are quite slow in nlvm. There are a couple of tricks to speed up method calls: Declare methods as final, private, or static when possible. Final, private, and static methods can be dispatched faster then normal methods. Normal methods are assumed to be virtual, so they will be linked at runtime (vtable look up), while final, private, and static methods can be linked at compile time. Also try to avoid very short methods and instead try to access the data directly, because nlvm currently does not optimize methods very well.

    Also keep in mind that rendering large transparent polygons puts quite a stress on the GPU, so the slow down may not directly be caused by the script, but instead may be caused by limited pixel fill rate. Try reducing the window size. If that increases fps, your system is GPU fillrate/blend limited. Try to minimize the number of large particles in this case instead of wasting time optimizing script code.
    •  
      CommentAuthorFüchschen
    • CommentTimeMar 3rd 2016
     
    Whats the best way to script a movement of an SCO from its position to the view matrix?
    It dosnt need an acceleration and something like that.

    Even a simple: look at X - function would work for me.
    •  
      CommentAuthorbestdani
    • CommentTimeMar 3rd 2016 edited
     
    I'd suggest to create three vector3f where two store the original sco pos and the matrix pos then use the lerp method for the third vector to interpolate between the two positions and finally set the sco to this position. You can additionally use the cubic, quintic or switch track ramp functions for the lerp parameter 'T' to create a smooth transition.

    You can also do this with the rotation vectors if you want to align it with the view.

    Or look if geforcefan's nl2 framework allows to use the view position.

    I think the "best" way depends on what you prefer or want to do.
    •  
      CommentAuthorFüchschen
    • CommentTimeMar 3rd 2016
     
    ^
    And here is the problem:
    i never understood how this type of math works. For me it sounds like quantum mechanics, what you said :D
    (maybe even worse. quantum mechanics are easy to understand, compared to my problem with vectors...)

    The framework would be a good thing, if i can find it in this forum.
    The best solution would be something like this:

    sco.moveTo(PositionOfViewMatrix, speed)
    sco.rotateTo(PositionOfViewMatrix, speed)

    This way i have a target position and a constant speed.
    And the sco rotates slowly, so that the front is faceing the view matrix.

    Image a "player" in a game picks up an item and it hovers in front of the camera, so that the player can better
    inspect what the character has picked up. Similar to Gothic or Skyrim.
    I need this for a park-plan, that someone can pick up from a info-shop.
    •  
      CommentAuthorFüchschen
    • CommentTimeMar 4th 2016
     
    i found a small problem in:
    "setTextureAnimationIndex(int n)"

    For example:
    There are 8 frames in the animation list.
    If i use "setTextureAnimationIndex(9)", it will start from 0 again.

    So it may need an exception or a function to read the total amount of frames in the list (like the total amount of coasters in a park).
    With that, everyone could decide if it needs to be resetted after all frames are played or not.

    if(index > scoEle.getTotalAnimationCount()){
    index = 0;
    }

    Or did i miss that function?

    But right now, i can work with the current functions, that are given.
    Its just something for more complex projects that needs to be perfectly timed, or when it comes to scripts, that adept to the amount of images used in an animation.

    This is just a random idea. Not sure if it is usefull or not.
    •  
      CommentAuthorbestdani
    • CommentTimeMar 4th 2016 edited
     
    ^ As far as I know this is intended since there are multiple texture slots and each animation can have a different number of frames.

    ^^ There's actually no math involved since the math is done by the lerp function.

    It's quite simple to use, pseudo code:

    Vector3f p, p1, p2;
    float t;
    p1.set(sco.getTranslation());
    p2.set(viewMatrix.getTrans());

    //do this per frame for example:
    p.lerp(t, p1, p2);
    sco.setTranslation(p);

    /*
    the value of t controls where p is on the thought line between p1 and p2 this means:
    t = 0.0f: p is at p1
    t = 0.5f: p is half way between p1 and p2:
    t = 1.0f: p is at p2

    and also (but I guess not required in your case):
    t = -1.0f: p is "before" p1 (the distance to p1 is the distance between p1 and p2)
    t = 2.0f: p is "behind" p2 (the distance to p2 is the distance between p1 and p2)
    t = 3.0f: p is "behind" p2 (the distance to p2 is twice the distance between p1 and p2)
    and so on.
    */


    To make it more smooth just use for example:

    p.lerp((float)Tools.cubicRamp(t), p1, p2);


    I guess cubicRamp also clamps the output to 0.0 ... 1.0 but I'm not sure about that.

    This works the same for the rotation.
  8.  
    Since I couldn't find a premade script to test the idea out, here's a script I wrote to attach an object to the zero car of a train. Basically one of the various custom train scripts with less ambition.

    import nlvm.math3d.*;
    import com.nolimitscoaster.*;

    public class AttachToZero extends Script
    {
    private SceneObject sco;
    private Train attachTrain;
    private Matrix4x4f t;

    public bool onInit()
    {
    //load the attachment object
    sco = sim.getSceneObjectForEntityId(getParentEntityId());
    if (sco == null)
    {
    System.err.println("Not a scene object");
    return false;
    }

    //find and save the train
    Coaster attachCoaster = sim.findNearestCoasterTrack(sco.getTranslation(),20).getCoaster();
    if (attachCoaster == null)
    {
    System.err.println("No nearby coaster");
    return false;
    }

    attachTrain = attachCoaster.findNearestTrain(sco.getTranslation(), 20);
    if (attachTrain == null)
    {
    System.err.println("No nearby train");
    return false;
    }

    t = new Matrix4x4f();

    return true;
    }

    public void onNextFrame(float tick){
    attachTrain.getCarMatrix(0,t);
    sco.setMatrix(t);
    }

    }
    •  
      CommentAuthorSedjuuurd
    • CommentTimeMar 4th 2016
     
    uhm hey bestdani. i used your script but i cant get past the part of:

    ViewTriggeredSound.nlvm: No view trigger object with the name 'Trigger:geluidsding' found!
    You have to ensure that a view trigger object trigger with the identical name prefix 'Trigger:' and the name that has been set to the scene object (no additional whitespaces etc.) is present in the park.
    The scene object names can be set in their respective property panel.
    •  
      CommentAuthorbestdani
    • CommentTimeMar 4th 2016 edited
     
    ^ Although it's actually described in the nl2script file description, at the beginning of the script itself but I see that's there's a chance to overlook it, here's a howto clip since I actually just tested if it really works: YouTube.
    •  
      CommentAuthorProjektion
    • CommentTimeMar 4th 2016
     
    Seeing all these amazing scripts on this page are just making me feel so inadequate. I'm having trouble trying to get some lights to fade properly, this is the bit of the script where the trouble is coming from.

    timer2 += 1.25f * sim.getCurSimulationTickSec();
    if (timer2 < 2)
    {
    for (int y=1; y<lightCount; ++y)
    {
    Spotlight1[y].setEnabled(true);
    Spotlight2[y].setEnabled(true);
    Spotlight3[y].setEnabled(true);
    Spotlight4[y].setEnabled(true);
    Spotlight5[y].setEnabled(true);

    Flash1[y].setEnabled(true);
    Flash2[y].setEnabled(true);
    Flash3[y].setEnabled(true);
    Flash4[y].setEnabled(true);
    Flash5[y].setEnabled(true);
    }

    } else if (timer2 >= 2 && timer2 < 7)
    {



    timer3 -= 0.25f * sim.getCurSimulationTickSec();
    System.err.println(timer3);
    for (int y=1; y<lightCount; ++y)
    {

    Spotlight1[y].setColor(0.25f*timer3, 0.24313f*timer3, 0.22254f*timer3);
    Spotlight2[y].setColor(0.25f*timer3, 0.24313f*timer3, 0.22254f*timer3);
    Spotlight3[y].setColor(0.25f*timer3, 0.24313f*timer3, 0.22254f*timer3);
    Spotlight4[y].setColor(0.25f*timer3, 0.24313f*timer3, 0.22254f*timer3);
    Spotlight5[y].setColor(0.25f*timer3, 0.24313f*timer3, 0.22254f*timer3);

    Flash1[y].setColor(1*timer3, 0.9724f*timer3, 0.8902f*timer3);
    Flash2[y].setColor(1*timer3, 0.9724f*timer3, 0.8902f*timer3);
    Flash3[y].setColor(1*timer3, 0.9724f*timer3, 0.8902f*timer3);
    Flash4[y].setColor(1*timer3, 0.9724f*timer3, 0.8902f*timer3);
    Flash5[y].setColor(1*timer3, 0.9724f*timer3, 0.8902f*timer3);
    }


    For some reason, as soon as timer3 starts counting down to get the lights to fade, they immediatly turn off.
    •  
      CommentAuthorFüchschen
    • CommentTimeMar 5th 2016 edited
     
    ^

    Try a scalar-product:


    for(int i = myLight.length-1; i >= 0; i--){
    LightColor.add((-0.01f));
    myLight[i].setColor(LightColor);
    }


    It would look like this in a fully functional script:


    package _SCRIPTS; // -> This not important for you. Its just a folder-name.

    import com.nolimitscoaster.*;
    import nlvm.math3d.*;
    import nlvm.lang.*;


    public class sLight_script extends Script{

    public static SceneObject sco;
    public static SceneObjectLight[] myLight = new SceneObjectLight[0]; // the size will automaticly be set.
    public static int countLights;
    public static int SEARCH_FOR_LIGHTS_RANGE = 1000;
    public static String lightPrefix = "Spot00"; //the name of the light

    public static Vector3f LightColor = new Vector3f(0.9f, 0.87f, 0.1337f);

    public bool onInit(){

    sco = NoLimits.getSimulator().getSceneObjectForEntityId(getParentEntityId());
    for(int i = SEARCH_FOR_LIGHTS_RANGE; i >= 0; i--){
    if(sco.getLightForName(lightPrefix+i) != null){ // Looks for 1000 possible lights in your SCO.
    countLights++; // This can be lowered with "SEARCH_FOR_LIGHTS_RANGE"
    }
    }

    myLight = new SceneObjectLight[countLights]; //sets the size of this array.
    for(int i = countLights; i > 0; i--){
    myLight[i-1]=sco.getLightForName(lightPrefix+i);
    }

    return true;
    }

    public void onNextFrame(float tick){

    for(int i = myLight.length-1; i >= 0; i--){
    LightColor.add((-0.01f)); // lower numbers -> slower fade. For a fade-in, the number must be positive.
    myLight[i].setColor(LightColor);
    }

    }
    }



    For a better precision, you should put the FOR-loop inside of an condition, that stops the value, when its lower than 0 and higher than 1.
    •  
      CommentAuthorbestdani
    • CommentTimeMar 5th 2016 edited
     
    ^^ I don't see a mistake so far but is there code before or afterwards(?) that disables the lights when timer2 is >=2? Maybe just copy the "setEnabled(true)" commands into the loop in the else if block, too. If it does not work I guess you should post the whole script.
    • CommentAuthorole
    • CommentTimeMar 5th 2016 edited
     
    ^^^ I do not see an error, too. But I noticed that the fading colors (0.25f*timer3, 0.24313f*timer3, 0.22254f*timer3) are quite low intensity... It looks like timer3 starts from 1, so the starting intensity is somewhere in the 0.25 region which is quite dark and may appear to you as switched off.

    ^^ Always scale with the tick, e.g. LightColor.add((-0.01f * tick)); otherwise the code is running at different speeds when the fps changes
    •  
      CommentAuthorFüchschen
    • CommentTimeMar 5th 2016
     
    ^
    i know. its not easy to concentrate during mid-night.
    It a quick and dirty example anyway.

    And different speeds, you say? That gives me some good ideas :)
    •  
      CommentAuthorProjektion
    • CommentTimeMar 5th 2016 edited
     
    ^^^Adding in the setEnabled(true); amongst all the setColor(); fixed it.



    ^^ They are low intensity just cause there are so many of them, if I set them any higher, it causes the light to just bleach whatever they're lighting up
  9.  
    ^May I ask what this is for?
    •  
      CommentAuthorProjektion
    • CommentTimeMar 5th 2016 edited
     
    ^A project I've had on my mind for a while now after I started playing around with lighting in NL2 For the moment, this is just testing to make sure I can actually get what I want to work when/if I move forward and work it a bit more
    •  
      CommentAuthorJL NoLimits
    • CommentTimeMar 5th 2016 edited
     
    I need help. I need a simple onboard sound script that plays the music on a trigger and stops the music on another trigger.
    If I have got that so can I learn from it.
    The scripts that I've found give this error:https://gyazo.com/501e64e985a03cdadec88567d4c71d23

    Explanation won't work with me. Just give a working script. Because that's the best way I learn things :)

    Edit: Solved
    •  
      CommentAuthorFüchschen
    • CommentTimeMar 6th 2016 edited
     
    How do i get the distance between 2 vectors?
    I know it has something to do with Euclidean distance, because Google said so.

    Is it something like:
    vec1.length() - vec2.length()
    It looks promising, but im not sure :/
    • CommentAuthorole
    • CommentTimeMar 6th 2016
     
    ^ Depends on the type of vector. If those are position vectors, then it is lenght of (vec2 - vec1)... or length of (vec1 - vec2) ... should be the same value.


    public static float distance(Vector3f vec1, Vector3f vec2)
    {
    Vector3f dif = new Vector3f(vec2);
    dif.sub(vec1);
    return dif.length();
    }
    •  
      CommentAuthorFüchschen
    • CommentTimeMar 6th 2016
     
    ^
    *sign... again logged out befor i could post*

    This time a bit shorter:
    Yes, they are position vectors

    I want to create a system, that maps the position of the view-camera to a grid.
    The amount of subdivisions on the sco depends on its scale.

    if the scale factor is 5, then there are 5x5 vectors, each in the middle of a square


    There is also a boolean array with the same size and the closest vector turns the boolean value with the same index to "true".

    Not sure, if this is the best way to do this. My fear is, that it has a huge impact on the performance.
    I really need a good advice on this, because im running this script in a park that already has 5 fps.

    *and please dont anything like:
    Posted By: oleI do not really see the point in coding a client when you do not even have basic knowledge of networking

    This was also the main reason, why i didn't see any point in buying the professional version of NL2.
    I know, It's off-topic, but i have always the fear, that you would come up with another line like this, when you answer one of my questions >.<
    • CommentAuthorole
    • CommentTimeMar 6th 2016 edited
     
    ^ I am happy to help others having problems with scripting or using the program, but I personally do not really like to teach others how to code. That is not my job. That was the point of my original post, because a very high amount of your questions are related to basics of how to code in general. If others will help you there, that is totally okay, but I have other customers to take of, too. Nobody is forced to buy the pro version when not used for professional purposes.