Jump to content

Hi There

Welcome to Klub Exile. If you happened to make your way to the site either from Lovers Lab or a Search on Google, we are glad you found us.  To unlock the entire site you will need to have a account registered.  Don't worry it is free but in the mean time you can read up on why we made the site and other little tidbits.  Feel free to join or Discord Server also if you have any more questions.  Thanks for stopping by and See You on the other side.

admin admin
  • 0

Scripts - How Ro Rotate Along A Vertical Axis?


Number251137

Question

Hi again,

So, not sure this really belongs here, but the mods can always move it if it isn't. 🙂

Basically, I've been playing around with Scripts for a long time now, but it's always been a case of adapting the scripts that pervokpetr orginally created - how it all works, I have absolutely no idea! Experimentation has been my watchword so far, but I'm now stuck. I'm trying to get the rotating script (attached) to rotate along the vertical axis instead of the horizontal one... any ideas?

Thanks,

- Number251137

sc_object_rotorblades_rotate_fast1.rar

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1
8 hours ago, Number251137 said:

Hi again,

So, not sure this really belongs here, but the mods can always move it if it isn't. 🙂

Basically, I've been playing around with Scripts for a long time now, but it's always been a case of adapting the scripts that pervokpetr orginally created - how it all works, I have absolutely no idea! Experimentation has been my watchword so far, but I'm now stuck. I'm trying to get the rotating script (attached) to rotate along the vertical axis instead of the horizontal one... any ideas?

Thanks,

- Number251137

sc_object_rotorblades_rotate_fast1.rar 747 B · 1 download

Here is one for the shower animation i used.

local script = {}
--SCRIPT BODY - any functions and calculations
--====================================================================================================
--main function that will be used as frame update callback
--id         - object id allow access to object storage
--delta     - time passed from last frame, i.e frame time
local function update( id, delta ) 

    --here the main script things logic, calculations and so on
    local st = db.storage[id]
    if st then
        --you can use any local script function from script body
        st.object.rotation = st.object.rotation + Vector3( 0, st.speed, 0 ) * delta  These are the axis. 0 = dont use, st.speed = use this axis, 0 = dont use its X,Y,Z. so i rotate on Y here.
    end
    
end
--================================================================================================
--BIND - this function called when object binded with script and allow register all desired callbacks
--================================================================================================
function script:bind_to_object( st, binder )--object storage and callback binder
    
    --declare per object variables
    st.speed = -40 --degree in sec.              this will be the speed of the rotation. you can also set - to set the rotation direction it will turn - 40 degrees every second.
    
    --register callback in array of active callbacks
    binder:add_callback( CALLBACK_GLOBAL, "on_frame_update", st.object.id, update )
    --callback class
    --callback type
    --object id
    --function that will be used as callback
end
--====================================================================================================
--script registration
db.script_list["sc_simple_rotation_showeranimator0"] = script Dont use caps here or it will break.

 

Here is my X,Y,Z scripts you can use.

scripts.rar

 

Ask if anything is unclear. 🙂

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

WARNING! Adult Only Content You must be 18 years of age or older to enter. By accepting you agree to Klub Exile's Terms of Use and Guidelines upon creating an account.