Random start view in autotour

  • Hi everyone,

    I'm new to the forum.

    I'm trying to do something that should be simple, but is not yet working out.

    I have two scenes set to autotour using the timer by Sudarchikov Andrey to switch from one to the other


    I would like to get a random value for the hlookat (and vlookat) each time one scene reloads.

    Any suggestion?

  • Hi,

    e.g. add this after the loadscene() call:

    Code
    mul(view.hlookat, random, 360);
    sub(view.hlookat, -180);
    mul(view.vlookat, random, 180);
    sub(view.vlookat, -90);

    This will generate random values in the range -180 to +180 for hlookat and -90 to +90 for vlookat.

    But it might be more sense-full to use narrow ranges for vlookat to avoid with starting looking directly at the sky or the floor, e.g. use:

    Code
    mul(view.vlookat, random, 60);
    sub(view.vlookat, -30);

    to use a range from -30 to +30.

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!